]> git.ipfire.org Git - thirdparty/glibc.git/commit
ia64: Fix memchr for large input sizes (BZ #22603)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 14 Dec 2017 11:05:46 +0000 (09:05 -0200)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 10 Jan 2018 20:56:05 +0000 (21:56 +0100)
commit268bd5f053204b80e771169e55b45704c04d77ad
tree57d97c8b173eeb5ce4dfe7fe7f4f63a539284ef6
parent989f59db3940ab4b76176af9a62b6980eafb7a22
ia64: Fix memchr for large input sizes (BZ #22603)

Current optimized ia64 memchr uses a strategy to check for last address
by adding the input one with expected size.  However it does not take
care for possible overflow.

It was triggered by 3038145ca23 where default rawmemchr now uses memchr
(p, c, (size_t)-1).

This patch fixes it by implement a satured addition where overflows
sets the maximum pointer size to UINTPTR_MAX.

Checked on ia64-linux-gnu where it fixes both stratcliff and
test-rawmemchr failures.

Adhemerval Zanella  <adhemerval.zanella@linaro.org>
James Clarke <jrtc27@jrtc27.com>

[BZ #22603]
* sysdeps/ia64/memchr.S (__memchr): Avoid overflow in pointer
addition.

(cherry picked from commit 3bb1ef58b989012f8199b82af6ec136da2f9fda3)
ChangeLog
sysdeps/ia64/memchr.S