glibc/sysdeps
Adhemerval Zanella 3daef2c8ee Fix x86_64 memchr for large input sizes
Current optimized memchr for x86_64 does for input arguments pointers
module 64 in range of [49,63] if there is no searchr char in the rest
of 64-byte block a pointer addition which might overflow:

* sysdeps/x86_64/memchr.S

    77          .p2align 4
    78  L(unaligned_no_match):
    79          add     %rcx, %rdx

Add (uintptr_t)s % 16 to n in %rdx.

    80          sub     $16, %rdx
    81          jbe     L(return_null)

This patch fixes by adding a saturated math that sets a maximum pointer
value if it overflows (UINTPTR_MAX).

Checked on x86_64-linux-gnu and powerpc64-linux-gnu.

	[BZ# 19387]
	* sysdeps/x86_64/memchr.S (memchr): Avoid overflow in pointer
	addition.
	* string/test-memchr.c (do_test): Remove alignment limitation.
	(test_main): Add test that trigger BZ# 19387.
2016-12-27 10:50:41 -02:00
..
aarch64 Refactor long double information into bits/long-double.h. 2016-12-14 18:27:56 +00:00
alpha Refactor long double information into bits/long-double.h. 2016-12-14 18:27:56 +00:00
arm New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
generic PLT avoidance for __stack_chk_fail [BZ #7065] 2016-12-26 10:11:05 +01:00
gnu Define wordsize.h macros everywhere 2016-11-04 09:37:44 -07:00
hppa Add missing hidden_def (__sigsetjmp). 2016-12-01 20:49:25 +00:00
i386 Compile the dynamic linker without stack protection [BZ #7065] 2016-12-26 10:08:48 +01:00
ia64 Refactor long double information into bits/long-double.h. 2016-12-14 18:27:56 +00:00
ieee754 Add roundeven, roundevenf, roundevenl. 2016-12-21 01:48:27 +00:00
init_array Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
m68k Refactor long double information into bits/long-double.h. 2016-12-14 18:27:56 +00:00
mach Fix hurd __access_noerrno implementation. 2016-11-18 16:49:08 -02:00
microblaze Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
mips Refactor long double information into bits/long-double.h. 2016-12-14 18:27:56 +00:00
nacl Do not stack-protect ifunc resolvers [BZ #7065] 2016-12-26 10:08:41 +01:00
nios2 Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
nptl Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
posix hurd: fix fcntl visibility 2016-09-18 23:48:55 +02:00
powerpc Do not stack-protect ifunc resolvers [BZ #7065] 2016-12-26 10:08:41 +01:00
pthread Installed-header hygiene (BZ#20366): time.h types. 2016-09-23 08:43:56 -04:00
s390 Refactor long double information into bits/long-double.h. 2016-12-14 18:27:56 +00:00
sh Add missing hidden_def (__sigsetjmp). 2016-12-01 20:49:25 +00:00
sparc Refactor long double information into bits/long-double.h. 2016-12-14 18:27:56 +00:00
tile Add missing hidden_def (__sigsetjmp). 2016-12-01 20:49:25 +00:00
unix Do not stack-protect sigreturn stubs [BZ #7065] 2016-12-26 10:11:06 +01:00
wordsize-32 Define wordsize.h macros everywhere 2016-11-04 09:37:44 -07:00
wordsize-64 Define wordsize.h macros everywhere 2016-11-04 09:37:44 -07:00
x86 Disable TSX on some Haswell processors. 2016-12-19 14:15:57 +03:00
x86_64 Fix x86_64 memchr for large input sizes 2016-12-27 10:50:41 -02:00