Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seekable Format Empty String Bug Fix #12

Closed
wants to merge 3 commits into from

Conversation

daniellerozenblit
Copy link
Owner

@daniellerozenblit daniellerozenblit commented Dec 13, 2022

This PR is a followup to a previous PR. The goal of the previous PR was to fix a small bug in seekable_format that led to the omission of the ZSTD MAGIC when compressing an empty string.

I have validated the bug fix with the test case provided, but have created this PR to fix some minor issues (forgetting to free malloc'd memory in the test case).

Note that, upon further investigation, it seems that this issue occured whenever ZSTD_inBuffer.size == 0, rather than explicitly for an empty string (NULL first char). For example, if we set the size of inBuffer to 255, set the first char to NULL, and set ZSTD_inBuffer.size == sizeof(inBuffer), the ZSTD MAGIC was present. On the other hand, if we set ZSTD_inBuffer.size == strlen(inBuffer) , the ZSTD MAGIC was omitted.

@daniellerozenblit daniellerozenblit changed the title Seekable format empty string Seekable Format Empty String Bug Fix Dec 13, 2022
@daniellerozenblit daniellerozenblit deleted the seekable-format-empty-string branch December 15, 2022 21:06
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.

2 participants