Skip to content

Seekable format empty string#3343

Closed
daniellerozenblit wants to merge 3 commits intofacebook:devfrom
daniellerozenblit:seekable-format-empty-string
Closed

Seekable format empty string#3343
daniellerozenblit wants to merge 3 commits intofacebook:devfrom
daniellerozenblit:seekable-format-empty-string

Conversation

@daniellerozenblit
Copy link
Contributor

@daniellerozenblit daniellerozenblit commented Dec 13, 2022

This PR is a followup to a previous PR by @yhoogstrate. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants