GHSA-7fqq-q52p-2jjg: Opencc OpenCC Has An Out-of-bounds Read Vulnerability
MODERATEGHSA-7fqq-q52p-2jjg is a MODERATE (CVSS 6.5) opencc has an out-of-bounds read vulnerability (CWE-125: Out-of-bounds Read) affecting Opencc libraries in the npm ecosystem. The issue involves opencc has an out-of-bounds read when processing truncated utf-8 input. Remediation is available by upgrading affected packages to version 1.2.0.
GHSA-7fqq-q52p-2jjg at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L).
How to Fix GHSA-7fqq-q52p-2jjg
To remediate this vulnerability, upgrade all affected Opencc dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install opencc@1.2.0
pip install OpenCC>=1.2.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls opencc
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-7fqq-q52p-2jjg, inspect your project dependencies using npm:
npm ls opencc
Analyze the terminal output to locate any version of Opencc in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.0), your application is affected.
Note: The npm ls opencc command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Opencc, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-7fqq-q52p-2jjg Affected Opencc Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
opencc
|
npm |
< 1.2.0
|
1.2.0
|
|
OpenCC
|
PyPI |
< 1.2.0
|
1.2.0
|
References
Frequently Asked Questions
What is GHSA-7fqq-q52p-2jjg?
Which Opencc versions are affected?
What version fixes GHSA-7fqq-q52p-2jjg?
Is opencc affected?
Is OpenCC affected?
What is the CVSS score of GHSA-7fqq-q52p-2jjg?
What CWE is associated with GHSA-7fqq-q52p-2jjg?
How can I check npm dependencies for GHSA-7fqq-q52p-2jjg?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7fqq-q52p-2jjg",
"modified" : "2026-03-29T15:27:41Z",
"published" : "2026-03-29T15:27:41Z",
"aliases" : [ ],
"summary" : "OpenCC has an Out-of-bounds read when processing truncated UTF-8 input",
"details" : "### Summary\n\nOpenCC 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.\n\n### Details\n\nTwo independent code paths in OpenCC failed to enforce the invariant:\n\n`matchedLength <= remainingLength`\n\nBoth 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:\n\n`invalid UTF-8 -> incorrect derived length -> incorrect pointer advance -> remaining-length desynchronization -> out-of-bounds read`\n\nIn `MaxMatchSegmentation::Segment`, this could desynchronize remaining-length tracking and cause out-of-bounds reads during prefix matching.\n\nIn `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.\n\nPR #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.\n\nAffected versions:\n\n* All versions before 1.2.0\n\nPatched version:\n\n* 1.2.0\n\n### PoC\n\nBuild 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).\n\n### Impact\n\nThis vulnerability may cause process crashes and limited, non-deterministic information disclosure when OpenCC processes malformed or attacker-controlled UTF-8 input. The issue does not indicate arbitrary write or code execution.\n\nOpenCC is distributed through system and language-specific package managers, prebuilt binaries, container images, and downstream software, so affected versions may be present even when it is not listed as a direct dependency. Users should upgrade all installed or bundled copies of OpenCC to 1.2.0 or later.\n\n### Credit\n\nOpenCC thanks @oneafter for reporting the issue.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "opencc"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.2.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "OpenCC"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.2.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/BYVoid/OpenCC/security/advisories/GHSA-7fqq-q52p-2jjg"
}, {
"type" : "WEB",
"url" : "https://github.com/BYVoid/OpenCC/issues/997"
}, {
"type" : "WEB",
"url" : "https://github.com/BYVoid/OpenCC/pull/1005"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/BYVoid/OpenCC"
}, {
"type" : "WEB",
"url" : "https://github.com/BYVoid/OpenCC/releases/tag/ver.1.2.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-125" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-29T15:27:41Z",
"nvd_published_at" : null
}
}