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

lminiz: return nil on deflate/inflate failure #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bilal2453
Copy link
Contributor

@Bilal2453 Bilal2453 commented Aug 31, 2024

When miniz returns NULL on tdefl_compress_mem_to_heap and tinfl_decompress_mem_to_heap signaling an error, lminiz will still return a string to the end user, an empty string in this case. This pull changes this behavior to return back a nil value plus an error message to be consistent with the rest of the API.

This change may not be necessarily wanted, as an empty string should still be valid for an error indication, as it seems miniz refuse to inflate a ZLib-ed empty string (i.e. an empty string with zlib header only, e.g. miniz.deflate("")).

@SinisterRectus
Copy link
Member

Not sure what to do with this. Is an empty string a problem?

@Bilal2453
Copy link
Contributor Author

Besides not being intuitive, it is not a problem on its own, no.

This pull should only be considered if a string return is not the intended behavior and a check was forgotten. Looking at the rest of the code it doesn't make much sense for this to be different from the rest of errors, so I assumed it was a forgotten check.

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