mediumCVSS 6.5Vulnerability

GHSA-7fqq-q52p-2jjg

### Summary OpenCC versions before 1.2.0 contain two `CWE-125: Out-of-bounds Read` issues caused by length validation failures in UTF-8 processing. When handling malformed or truncated UTF-8 input, OpenCC trusted derived length values without enforcing the invariant that processed length must not exceed the remaining input buffer. This could result in out-of-bounds reads during segmentation or conversion. ### Details Two independent code paths in OpenCC failed to enforce the invariant: `matchedLength <= remainingLength` Both paths assumed derived length values were valid and within input bounds, but did not validate that assumption against the remaining buffer. This created the following failure chain: `invalid UTF-8 -> incorrect derived length -> incorrect pointer advance -> remaining-length desynchronization -> out-of-bounds read` In `MaxMatchSegmentation::Segment`, this could desynchronize remaining-length tracking and cause out-of-bounds reads during prefix matching. In `Conversion::Convert(const char*)`, similar logic could advance processing past the end of the input string and read beyond the null terminator into adjacent memory. In some cases, unintended heap bytes could be propagated into the conversion result. PR #1005 fixes both issues by explicitly tracking input boundaries, recomputing remaining length on each iteration, and clamping processed lengths so the buffer-bound invariant is preserved. Affected versions: * All versions before 1.2.0 Patched version: * 1.2.0 ### PoC Build a vulnerable version with AddressSanitizer enabled and process input ending with a truncated UTF-8 sequence, such as a missing final byte of a 3-byte character. The original report and ASan reproduction are available in [Issue #997](https://github.com/BYVoid/OpenCC/issues/997). ### Impact This vulnerability may cause process crashes and limited, non-deterministic information disclosure when OpenCC processes malformed or attacker-controlled UTF-8 input. The issue

Properties

ghsa_id
GHSA-7fqq-q52p-2jjg
severity
medium
summary
OpenCC has an Out-of-bounds read when processing truncated UTF-8 input
cvss_score
6.5
cve_id
GHSA-7fqq-q52p-2jjg
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L
is_ghsa_only
true
ghsa_published
2026-03-29T15:27:41Z
source_url
https://github.com/advisories/GHSA-7fqq-q52p-2jjg
ghsa_updated
2026-03-29T15:27:43Z

Related Entities (4)

AFFECTS (2)

[Software]pip/OpenCC
[Software]npm/opencc

HAS_WEAKNESS (1)

[Weakness]Out-of-bounds Read

REPORTED_BY (1)

[Source]GitHub Advisory Database

Explore deeper with Ninja Signal's threat intelligence graph

GHSA-7fqq-q52p-2jjg (CVSS 6.5) — Ninja Signal Threat Intelligence | Ninja Signal