CVE-2026-35201
Signed Length Truncation Causes Out-of-Bounds Read in Discount Markdown Parser
Publication date: 2026-04-06
Last updated on: 2026-04-16
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| dafoster | rdiscount | From 1.3.1.1 (inc) to 2.2.7.4 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-125 | The product reads data past the end, or before the beginning, of the intended buffer. |
Attack-Flow Graph
AI Powered Q&A
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
This vulnerability causes a denial-of-service (DoS) by crashing the Ruby process when parsing very large Markdown inputs due to an out-of-bounds read. It does not impact confidentiality, integrity, or privilege escalation.
Since the vulnerability does not lead to data leakage, unauthorized access, or modification, it does not directly affect compliance with common standards and regulations such as GDPR or HIPAA, which primarily focus on protecting personal data confidentiality and integrity.
Can you explain this vulnerability to me?
CVE-2026-35201 is a vulnerability in the rdiscount RubyGem, a Markdown parser implemented in C. It occurs because the parser uses a signed 32-bit integer to represent the length of the input string. When the input length exceeds the maximum value for a signed 32-bit int (INT_MAX), the length is truncated to a negative number. This causes the parser to read beyond the end of the input buffer, leading to an out-of-bounds read and a crash of the Ruby process.
The issue arises specifically in the default Markdown parsing path when very large inputs (larger than 2.1 billion characters) are processed. The vulnerability can be triggered by passing such large inputs to the public APIs `RDiscount.new(input).to_html` or `RDiscount.new(input).toc_content`.
The root cause is a signed length truncation bug where the input length is passed as an int parameter to the native parser function without proper validation, allowing the parserβs read loop to continue reading past the buffer end.
How can this vulnerability impact me? :
This vulnerability can be exploited to cause a denial-of-service (DoS) condition by crashing the Ruby process that is parsing Markdown input. An attacker can supply a very large Markdown input (multi-gigabyte size) which triggers the out-of-bounds read and causes the process to crash.
There is no impact on confidentiality, integrity, or privilege escalation. The main impact is availability loss due to the process crash.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by testing if the Ruby process using the rdiscount Markdown parser crashes when processing very large Markdown inputs exceeding 2,147,483,647 characters.
A practical detection method is to attempt to parse a Markdown string larger than INT_MAX (2,147,483,647) characters using the affected public APIs `RDiscount.new(input).to_html` or `RDiscount.new(input).toc_content` and observe if the process crashes with a segmentation fault.
There are no specific network commands to detect this vulnerability since it is triggered by local input size handling, but you can monitor for crashes or segmentation faults in the Ruby process running rdiscount.
What immediate steps should I take to mitigate this vulnerability?
The immediate mitigation step is to upgrade the rdiscount package to version 2.2.7.4 or later, where the vulnerability is fixed.
If upgrading is not immediately possible, apply input validation to reject Markdown inputs larger than INT_MAX (2,147,483,647) characters before passing them to the parser.
Specifically, add a length check before calling the native parser function `mkd_string()`. If the input length exceeds INT_MAX, raise an error to prevent the out-of-bounds read and crash.
- Upgrade rdiscount to version 2.2.7.4 or later.
- Implement input length validation to reject overly large Markdown inputs.
- Monitor Ruby processes using rdiscount for crashes or segmentation faults as an indicator of exploitation attempts.