Unconditionally consume buffers to avoid stale data by ngoldbaum · Pull Request #226 · python-hyper/brotlicffi · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
6 changes: 2 additions & 4 deletions src/brotlicffi/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,8 @@ def _decompress(self, data, output_buffer_limit):
chunks.append(chunk)
chunks_len += len(chunk)

# Save any unconsumed input for the next call.
if available_in[0] > 0:
remaining_input = ffi.buffer(next_in[0], available_in[0])[:]
self._unconsumed_data = remaining_input
# Save input for the next call
self._unconsumed_data = ffi.buffer(next_in[0], available_in[0])[:]

# Check if we've reached the output limit.
if (
Expand Down
19 changes: 19 additions & 0 deletions test/test_simple_decompression.py
Loading