]> git.ipfire.org Git - thirdparty/glibc.git/commit
elf: Fix UB on _dl_early_allocate
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 18 Apr 2025 12:45:40 +0000 (09:45 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 7 May 2025 17:21:20 +0000 (14:21 -0300)
commit84c6cfb9b6bd753827c7ed0db99f2b115594a598
tree992fe16991d84852b10d03893b384b4df0358199
parent5c94ce98f77179c94264176525b001888d6664a8
elf: Fix UB on _dl_early_allocate

The ubsan triggers on elf/tst-tls-allocation-failure-static-patched:

UBSAN: Undefined behaviour in ../sysdeps/unix/sysv/linux/dl-early_allocate.c:58:16 pointer index expression with base 0x0000555578792000 overflowed  to 0x8000555578792cc0

The function is called with a size larger than PTRDIFF_MAX, and
the addition than overflow.  Fix it by limiting the size up to
PTRDIFF_MAX, like all other malloc functions.
sysdeps/unix/sysv/linux/dl-early_allocate.c