From 906b5edb8602f188218cc432481ed893644bc534 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 23 Jun 2024 00:52:06 +0200 Subject: [PATCH] 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 --- libdwfl/gzip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c index 002afc4e9..9c74abdaf 100644 --- a/libdwfl/gzip.c +++ b/libdwfl/gzip.c @@ -212,6 +212,7 @@ unzip (int fd, off_t start_offset, else { state.input_buffer = *state.whole; + mapped = state.input_buffer; state.input_pos = state.mapped_size = *whole_size; } } -- 2.47.3