Skip to content

Potential Vulnerability in Cloned Code#1038

Open
tabudz wants to merge 3 commits into
marian-nmt:masterfrom
tabudz:CVE-2018-25032
Open

Potential Vulnerability in Cloned Code#1038
tabudz wants to merge 3 commits into
marian-nmt:masterfrom
tabudz:CVE-2018-25032

Conversation

@tabudz

@tabudz tabudz commented Oct 27, 2025

Copy link
Copy Markdown

Summary

Our tool detected a potential vulnerability in src/3rd_party/zlib which was cloned from madler/zlib but did not receive the security patch applied in madler/zlib. The original issue was reported and fixed under https://nvd.nist.gov/vuln/detail/CVE-2018-25032.

Proposed Fix

Apply the same patch as the one in madler/zlib to eliminate the vulnerability.

Reference

https://nvd.nist.gov/vuln/detail/CVE-2018-25032
madler/zlib@5c44459

Added dependencies: none

Checklist

  • I have tested the code manually
  • I have run regression tests
  • I have read and followed CONTRIBUTING.md
  • I have updated CHANGELOG.md

This bug was reported by Danilo Ramos of Eideticom, Inc. It has
lain in wait 13 years before being found! The bug was introduced
in zlib 1.2.2.2, with the addition of the Z_FIXED option. That
option forces the use of fixed Huffman codes. For rare inputs with
a large number of distant matches, the pending buffer into which
the compressed data is written can overwrite the distance symbol
table which it overlays. That results in corrupted output due to
invalid distances, and can result in out-of-bound accesses,
crashing the application.

The fix here combines the distance buffer and literal/length
buffers into a single symbol buffer. Now three bytes of pending
buffer space are opened up for each literal or length/distance
pair consumed, instead of the previous two bytes. This assures
that the pending buffer cannot overwrite the symbol table, since
the maximum fixed code compressed length/distance is 31 bits, and
since there are four bytes of pending space for every three bytes
of symbol space.
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