Skip to content

Commit

Permalink
Fix error revealed by test x.compressed.03 which has a backward refer…
Browse files Browse the repository at this point in the history
…ence for a symbol at the start of the data
  • Loading branch information
sidney committed Feb 4, 2021
1 parent 72f06e1 commit 6bd20cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- Fixed issue with compressed input that contains data split across multiple metadata blocks
- Some changes to unit/integration tests to better support testing issues in compression format
- Renamed test module to conform to pattern expected by unittest
- Unit tests can now test using multiple compressed versions of each uncompressed example file
- Fixed error revealed by one of the newly tested cases involving an edge case in compressed format

## [1.0.2] - 2021-02-02

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ which it is not practical to package or require platform-specific binaries. It i
the decompression function, under the assumption that will be the most common use-case that
might have that restriction. It is hundreds of times slower than the reference `brotli`.

This is a hand port of the decompression portion of the Javascript project that is
This code began as a hand port of the decompression portion of the Javascript project that is
itself a hand port of the C code of the reference implementation.

* JavaScript port of brotli [brotli.js](https://github.com/devongovett/brotli.js)
Expand Down
4 changes: 2 additions & 2 deletions brotlidecpy/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ def brotli_decompress_buffer(input_buffer):
kInsertLengthPrefixCode[insert_code].nbits)
copy_length = kCopyLengthPrefixCode[copy_code].offset + br.read_bits(
kCopyLengthPrefixCode[copy_code].nbits)
prev_byte1 = output_buffer[pos - 1]
prev_byte2 = output_buffer[pos - 2]
prev_byte1 = output_buffer[pos - 1] if pos > 0 else 0
prev_byte2 = output_buffer[pos - 2] if pos > 1 else 0
for j in range(0, insert_length):
if block_length[0] == 0:
decode_block_type(num_block_types[0], block_type_trees, 0, block_type, block_type_rb,
Expand Down

0 comments on commit 6bd20cf

Please sign in to comment.