]> git.ipfire.org Git - thirdparty/libarchive.git/commit
RAR5 reader: Fixed a read from invalid memory block
authorGrzegorz Antoniak <ga@anadoxin.org>
Fri, 18 Jan 2019 05:17:19 +0000 (06:17 +0100)
committerGrzegorz Antoniak <ga@anadoxin.org>
Fri, 18 Jan 2019 05:17:19 +0000 (06:17 +0100)
commit520f98b00802054d3945f39000a09f60a226084a
treec0a35e69b076b1fee58f6956220c95f4ef97476f
parentce8ddb0ae1ea6b92e4ccac827e1cb79b76e6df80
RAR5 reader: Fixed a read from invalid memory block

In multi-file RAR5 archives, if a block spans from one file to another,
the RAR5 reader merges both blocks into one, and feeds this merged block
to the decompressor function. The problem is that the block merge
function allocates the exact number of bytes for this block. This is
problematic because when trying to read the last byte from this new
block with bit reader functions, the bit reader functions will reference
few additional bytes right after the byte the caller is trying to read,
resulting in an out of bounds read.

The commit increases the allocation size for new merged block. This
ensures that bit reader functions will never perform any out of bounds
reads. Additional space is zeroed out to prevent errors from
instrumentation tools like ASan or Valgrind.

Fixes #1119
libarchive/archive_read_support_format_rar5.c