]> 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)
committerGitHub <noreply@github.com>
Fri, 11 Oct 2024 06:16:12 +0000 (08:16 +0200)
commit565b5aea491671ae33df1ca63697c10d54c00165
treeb2f6c8ac63756804a0d1cfd0975486367c379575
parentb34c1f4def427e21b821dd0837208ede51532281
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
libarchive/archive_read_support_format_tar.c