]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Don't crash on truncated tar archives (#2364)
authorTim Kientzle <kientzle@acm.org>
Fri, 11 Oct 2024 06:16:12 +0000 (23:16 -0700)
committerMartin Matuska <martin@matuska.de>
Fri, 11 Oct 2024 06:21:00 +0000 (08:21 +0200)
commitdbb67cb2a484049ed661d926dac2b350964f6f1b
tree66c790a5ac5c19a02961db1c8436c503208af216
parentd5d3ba73144cfb53a99d259910567657f06d5ede
Don't crash on truncated tar archives (#2364)

The tar header parsing overhaul in #2127 introduced a systematic
mishandling of truncated files: the code incorrectly checks for whether
a given read operation failed, and ends up dereferencing a NULL pointer
in this case. I've gone back and double-checked how
`__archive_read_ahead` actually works (it returns NULL precisely when it
was unable to satisfy the read request) and reworked the error handling
for each call to this function in archive_read_support_format_tar.c

Resolves #2353
Resolves https://issues.oss-fuzz.com/issues/42537231

(cherry picked from commit 565b5aea491671ae33df1ca63697c10d54c00165)
libarchive/archive_read_support_format_tar.c