Skip to content

fix: Bound decode_compressed to the length zlib actually wrote - #1622

Closed
Mounika2456 wants to merge 1 commit into
brainboxdotcc:masterfrom
Mounika2456:etf-compressed-length
Closed

fix: Bound decode_compressed to the length zlib actually wrote#1622
Mounika2456 wants to merge 1 commit into
brainboxdotcc:masterfrom
Mounika2456:etf-compressed-length

Conversation

@Mounika2456

Copy link
Copy Markdown

decode_compressed trusts the uncompressed size declared in the term header instead of the length uncompress() reports back, so a term that declares more than its zlib stream produces has the remainder decoded out of heap that was never written.

An ett_compressed term declaring 4096 bytes whose stream deflates to five (an ett_binary header announcing 4080 bytes of payload) comes back as a 4080 character string assembled from that memory; under ASAN the same input trips container-overflow in read_8_bits, since reserve() leaves the vector empty. zlibcontext::decompress already sizes its buffer and counts what inflate wrote, so this brings the term decoder in line with it. Covered by a new offline test that fails on master.

Code change checklist

  • I have ensured that all methods and functions are fully documented using doxygen style comments.
  • My code follows the coding style guide.
  • I tested that my change works before raising the PR.
  • I have ensured that I did not break any existing API calls.
  • I have not built my pull request using AI, a static analysis tool or similar without any human oversight.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added documentation Improvements or additions to documentation code Improvements or additions to code. labels Aug 1, 2026
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution, but PRs must be raised against the dev branch. Please log your pull request against the dev branch not master. You can also retarget this pull request, then reopen it.

@github-actions github-actions Bot closed this Aug 1, 2026
@Mounika2456

Copy link
Copy Markdown
Author

Superseded by #1623, which is this same branch raised against dev. GitHub won't let me reopen this one while that is open, so leaving it closed.

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

Labels

code Improvements or additions to code. documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants