]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdwfl: Make sure mapped is always set in unzip
authorMark Wielaard <mark@klomp.org>
Sat, 22 Jun 2024 22:52:06 +0000 (00:52 +0200)
committerMark Wielaard <mark@klomp.org>
Sat, 22 Jun 2024 22:54:55 +0000 (00:54 +0200)
commit906b5edb8602f188218cc432481ed893644bc534
tree3da6831850126841e6c276dba9883a9fee71cdc9
parent80aeca1b836e07897540aba45cbb3e74f1f7ca5d
libdwfl: Make sure mapped is always set in unzip

Found by GCC14 -Wanalyzer-null-argument.

When unzip is called with mapped NULL, but *_whole not NULL, *_whole
contains the first part of the input. But we check against mapped to
make sure the MAGIC bytes are there.

This only worked because this code path was never taken, unzip is
currently always called with *_whole being NULL.

  * libdwfl/gzip.c (unzip): Set mapped = state.input_buffer
          when *whole is not NULL.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/gzip.c