diff options
Diffstat (limited to 'sysdeps/i386/i686/multiarch/memchr-sse2.S')
-rw-r--r-- | sysdeps/i386/i686/multiarch/memchr-sse2.S | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/i386/i686/multiarch/memchr-sse2.S b/sysdeps/i386/i686/multiarch/memchr-sse2.S index 83930b7d38..303242ceee 100644 --- a/sysdeps/i386/i686/multiarch/memchr-sse2.S +++ b/sysdeps/i386/i686/multiarch/memchr-sse2.S @@ -1,5 +1,5 @@ /* Optimized memchr with sse2 without bsf - Copyright (C) 2011-2016 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -117,9 +117,13 @@ L(crosscache): # ifndef USE_AS_RAWMEMCHR jnz L(match_case2_prolog1) - lea -16(%edx), %edx - add %ecx, %edx - jle L(return_null) + /* "ecx" is less than 16. Calculate "edx + ecx - 16" by using + "edx - (16 - ecx)" instead of "(edx + ecx) - 16" to void + possible addition overflow. */ + neg %ecx + add $16, %ecx + sub %ecx, %edx + jbe L(return_null) lea 16(%edi), %edi # else jnz L(match_case1_prolog1) |