[Security] Signed overflow in src/builtin.c may lead to OOB read
Zhihan Zheng <[email protected]> Mon, 16 Mar 2026 21:03:42 +0800
| Newsgroups | gmane.comp.gnu.m4.bugs |
|---|---|
| Message-ID | <TYRP301MB1427B1CE6049F6E6E5BE6FCED140A@TYRP301MB1427.JPNP301.PROD.OUTLOOK.COM> |
Hello GNU m4 Maintainer, I would like to report a potential security issue in m4 1.4.21. The issue is in substr handling in src/builtin.c. The code checks: ```c if (start + length > avail) length = avail - start; obstack_grow (obs, ARG (1) + start, length); ``` Because start, length, and avail are stored as int, start + length can overflow. With crafted input, this can bypass the intended bounds logic and lead to an out-of-bounds read followed by a crash. Affected area: - src/builtin.c:1822-1847 If useful, I can provide a minimal PoC and sanitizer output. If you believe this is a valid security issue, please let me know your preferred remediation or coordinated disclosure process. If needed, I can also assist with CVE coordination after triage. -- Best regards, Zhihan Zheng Beijing Institute of Technology