Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix LZF decompression logic.#2065

Merged
michael-grunder merged 2 commits into
developfrom
lzf-mismatch-fix
Jan 26, 2022
Merged

Fix LZF decompression logic.#2065
michael-grunder merged 2 commits into
developfrom
lzf-mismatch-fix

Conversation

@michael-grunder

Copy link
Copy Markdown
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.
Comment thread library.c
data = emalloc(i * len);
if ((res = lzf_decompress(src, len, data, i * len)) == 0) {
/* errno != E2BIG will brake for loop */
efree(data);

Copy link
Copy Markdown
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