This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix x86 strncat optimized implementation for large sizes
- From: Siddhesh Poyarekar <siddhesh at gotplt dot org>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Date: Tue, 3 Jan 2017 20:35:41 +0530
- Subject: Re: [PATCH] Fix x86 strncat optimized implementation for large sizes
- Authentication-results: sourceware.org; auth=none
- References: <1483455360-818-1-git-send-email-adhemerval.zanella@linaro.org>
On Tuesday 03 January 2017 08:26 PM, Adhemerval Zanella wrote:
> Similar to BZ#19387, BZ#21014, and BZ#20971, both x86 sse2 strncat
> optimized assembly implementations do not handle the size overflow
> correctly.
>
> The x86_64 one is in fact an issue with strcpy-sse2-unaligned, but
> that is triggered also with strncat optimized implementation.
>
> This patch uses a similar strategy used on 3daef2c8ee4df2, where
> saturared math is used for overflow case.
>
> Checked on x86_64-linux-gnu and i686-linux-gnu.
>
> [BZ #19390]
> * string/test-strncat.c (test_main): Add tests with SIZE_MAX as
> maximum string size.
> * sysdeps/i386/i686/multiarch/strcat-sse2.S (STRCAT): Avoid overflow
> in pointer addition.
> * sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S (STRCPY):
> Likewise.
LGTM.
Siddhesh