google / google/brotli

[Python] `output_buffer_limit` is not fully respected

Open
#1,396 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.9k
Forks
1.4k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

Version 1.2.0 added `output_buffer_limit` – "If set, the output buffer will not grow once its size equal or exceeding that value."
While it does usually prevent decompressing the whole data at once, the output size is not limited by it.

```python
import brotli

compressed = brotli.compress(b"x" * (10 * 2**20)) # 10 MiB

decompressor = brotli.Decompressor()
print(len(decompressor.process(compressed, output_buffer_limit=2**20))) # Output 2_064_288, expected 1_048_576
print(len(decompressor.process(b"", output_buffer_limit=1024))) # Output 32_752, expected 1024
print(len(decompressor.process(b"", output_buffer_limit=32_753))) # Output 98_272, expected 32_753
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.