]> git.ipfire.org Git - thirdparty/glibc.git/commit
Fix integer overflow in malloc when tcache is enabled [BZ #22375]
authorArjun Shankar <arjun@redhat.com>
Thu, 30 Nov 2017 12:31:45 +0000 (13:31 +0100)
committerArjun Shankar <arjun@redhat.com>
Thu, 30 Nov 2017 12:42:53 +0000 (13:42 +0100)
commit34697694e8a93b325b18f25f7dcded55d6baeaf6
tree694ad7ce28c06d16baff488f97f09e46d373564a
parent18305fba5575a09063652014cfc483b898d8bdcd
Fix integer overflow in malloc when tcache is enabled [BZ #22375]

When the per-thread cache is enabled, __libc_malloc uses request2size (which
does not perform an overflow check) to calculate the chunk size from the
requested allocation size. This leads to an integer overflow causing malloc
to incorrectly return the last successfully allocated block when called with
a very large size argument (close to SIZE_MAX).

This commit uses checked_request2size instead, removing the overflow.
ChangeLog
malloc/malloc.c