]> git.ipfire.org Git - thirdparty/glibc.git/commit
x86: Fix wcsnlen-avx2 page cross length comparison [BZ #29591]
authorNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 21 Sep 2022 00:58:04 +0000 (17:58 -0700)
committerSunil K Pandey <skpgkp2@gmail.com>
Thu, 24 Nov 2022 22:26:47 +0000 (14:26 -0800)
commite7019eeeb5f9eb3bab956fb1ecfc867bf257bc9d
treea9a7e24e16da3109a49769fc172daceab077b2e3
parentfb73a409816dbbbe65e0820cdc10e77fdee2b0f6
x86: Fix wcsnlen-avx2 page cross length comparison [BZ #29591]

Previous implementation was adjusting length (rsi) to match
bytes (eax), but since there is no bound to length this can cause
overflow.

Fix is to just convert the byte-count (eax) to length by dividing by
sizeof (wchar_t) before the comparison.

Full check passes on x86-64 and build succeeds w/ and w/o multiarch.

(cherry picked from commit b0969fa53a28b4ab2159806bf6c99a98999502ee)
string/test-strnlen.c
sysdeps/x86_64/multiarch/strlen-avx2.S