8000 Fix LZF decompression logic. by michael-grunder · Pull Request #2065 · phpredis/phpredis · GitHub
[go: up one dir, main page]

Skip to content

Fix LZF decompression logic. #2065

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

Merged
merged 2 commits into from
Jan 26, 2022
Merged

Fix LZF decompression logic. #2065

merged 2 commits into from
Jan 26, 2022

Conversation

michael-grunder
Copy link
Member

Rework how we decompress LZF data. Previously it was possible to
encounter a double-free, if the error was not E2BIG.

Rework how we decompress LZF data.  Previously it was possible to
encounter a double-free, if the error was not E2BIG.
data = emalloc(i * len);
if ((res = lzf_decompress(src, len, data, i * len)) == 0) {
/* errno != E2BIG will brake for loop */
efree(data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just set data = NULL here after efree? 🙂

@michael-grunder michael-grunder merged commit 0719c1e into develop Jan 26, 2022
@michael-grunder michael-grunder deleted the lzf-mismatch-fix branch January 26, 2022 17:52
yatsukhnenko pushed a commit that referenced this pull request Feb 1, 2022
* Fix LZF decompression logic.

Rework how we decompress LZF data.  Previously it was possible to
encounter a double-free, if the error was not E2BIG.

* .
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
0