]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Handle zero size decompressed data.
authorMark Wielaard <mark@klomp.org>
Tue, 19 Feb 2019 15:27:40 +0000 (16:27 +0100)
committerMark Wielaard <mark@klomp.org>
Tue, 19 Feb 2019 15:27:40 +0000 (16:27 +0100)
commitff7fe986679b0811591ef6e40cf485fa9f037e07
tree035299f3a4b0867825c3c92a19ea5e75580e8423
parent1e52d4ce3aa2093d12901d32fe07aae70211fe2a
libelf: Handle zero size decompressed data.

This is a corner case that will most likely never occur in practice,
but we have several testcases that compress and decompress zero sized
data. In that case during decompression we might malloc a buffer of
size zero. It is allowed for malloc to return NULL in that case. But
we do need a non-NULL buffer to return and set as result. So make sure
to always at least allocate one byte. Also make sure that we don't
allocate a zero sized conversion buffer for the data.

https://sourceware.org/bugzilla/show_bug.cgi?id=24000

Signed-off-by: Mark Wielaard <mark@klomp.org>
libelf/ChangeLog
libelf/elf_compress.c