Skip to content

Conversation

@BenchBeach
Copy link

Hello,

This pull request enhances the robustness of the compress2 function by adding defensive checks for its parameters.

Similar to the recent improvements in uncompress2, this function can currently crash with a segmentation fault if passed NULL for its pointer arguments (dest, destLen, source). This change introduces a validation block at the start of the function to guard against this. It also validates the level parameter.

If an invalid parameter is detected, the function now safely returns Z_STREAM_ERROR instead of crashing, providing clear feedback to the developer.

This makes the function safer and more reliable. Happy to receive any feedback.

Thank you!

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