]> git.ipfire.org Git - thirdparty/libarchive.git/commit
RAR5 reader: reject files that declare invalid header flags 1326/head
authorGrzegorz Antoniak <ga@anadoxin.org>
Sun, 2 Feb 2020 07:04:41 +0000 (08:04 +0100)
committerGrzegorz Antoniak <ga@anadoxin.org>
Sun, 2 Feb 2020 07:04:41 +0000 (08:04 +0100)
commit94821008d6eea81e315c5881cdf739202961040a
tree7567c3ed78920b0e9738806dc25464e503c1ad6b
parent449d6c5faea3ee9b99fe4bcf3873470c7834187f
RAR5 reader: reject files that declare invalid header flags

One of the fields in RAR5's base block structure is the size of the
header. Some invalid files declare a 0 header size setting, which can
confuse the unpacker. Minimum header size for RAR5 base blocks is 7
bytes (4 bytes for CRC, and 3 bytes for the rest), so block size of 0
bytes should be rejected at header parsing stage.

The fix adds an error condition if header size of 0 bytes is detected.
In this case, the unpacker will not attempt to unpack the file, as the
header is corrupted.

The commit also adds OSSFuzz #20459 sample to test further regressions
in this area.
Makefile.am
libarchive/archive_read_support_format_rar5.c
libarchive/test/test_read_format_rar5.c
libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu [new file with mode: 0644]