Skip to content

[Python] output_buffer_limit is not fully respected #1396

@illia-v

Description

@illia-v

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions