Skip to content

Raise an exception when attempting to decompressing empty data#37

Merged
Rogdham merged 1 commit intomasterfrom
empty-input
May 2, 2025
Merged

Raise an exception when attempting to decompressing empty data#37
Rogdham merged 1 commit intomasterfrom
empty-input

Conversation

@Rogdham
Copy link
Copy Markdown
Owner

@Rogdham Rogdham commented May 1, 2025

From Zstandard specification:

Zstandard compressed data is made of one or more frames.

Currently, we allow to decompress empty data:

>>> decompress(b"")
b''

After the fix, this is not allowed anymore:

>>> decompress(b"")
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    decompress(b"")
    ~~~~~~~~~~^^^^^
pyzstd.ZstdError: Decompression failed: zstd data ends in an incomplete frame, maybe the input data was truncated. Decompressed data is 0 bytes.

@Rogdham Rogdham merged commit 86ab61b into master May 2, 2025
21 checks passed
@Rogdham Rogdham deleted the empty-input branch May 2, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant