]> 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)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Thu, 29 Sep 2022 03:15:16 +0000 (20:15 -0700)
commitb0969fa53a28b4ab2159806bf6c99a98999502ee
tree8aafe93540ffbf58be6b57e5ea5e71ba3fc5c030
parent3e5760fcb48528d48deeb60cb885a97bb731160c
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.
string/test-strnlen.c
sysdeps/x86_64/multiarch/strlen-avx2.S