Skip to content

Commit

Permalink
Fix Rocket decompression.
Browse files Browse the repository at this point in the history
It wasn't accounting for the output size in the header, causing it to
produce garbage data after the end of the decompressed data by
processing the unused descriptor bits in the last field that it read.
  • Loading branch information
Clownacy committed Aug 8, 2024
1 parent fd81dd2 commit bfcb94e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/rocket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ struct rocket_internal {
using RockIStream = LZSSIStream<RocketAdaptor>;
using diff_t = make_signed_t<size_t>;

in.ignore(2);
size_t const Size = BigEndian::Read2(in) + 4;
size_t const OutSize = BigEndian::Read2(in);
size_t const InSize = BigEndian::Read2(in) + 4;
RockIStream src(in);

while (in.good() && size_t(in.tellg()) < Size) {
while (in.good() && size_t(in.tellg()) < InSize && size_t(Dst.tellp()) < OutSize) {
if (src.descbit() != 0U) {
// Symbolwise match.
uint8_t const Byte = Read1(in);
Expand Down

0 comments on commit bfcb94e

Please sign in to comment.