Bug 2496135 (CVE-2026-58380)

Summary: CVE-2026-58380 gimp: gimp: Stack buffer overflow in pnmscanner_gettoken()
Product: [Other] Security Response Reporter: OSIDB Bzimport <bzimport>
Component: vulnerabilityAssignee: Product Security <prodsec-ir-bot>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: rhel-process-autobot, watson-tool-maintainers
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
A flaw was found in GIMP's PNM file format parser. When parsing a specially crafted PNM file, the pnmscanner_gettoken() function writes a null terminator one byte past the end of a stack-allocated buffer due to an off-by-one error in the loop boundary check. This could lead to memory corruption, potentially resulting in denial of service or arbitrary code execution.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description OSIDB Bzimport 2026-07-01 19:11:31 UTC
An off-by-one stack buffer overflow exists in GIMP's PNM file format parser. In pnmscanner_gettoken() in file-pnm.c, the loop condition ctr < bufsize allows ctr to reach bufsize (512), then buf[ctr] = '\0' writes one byte past the 512-byte stack buffer. The function is called from pnm_load_ascii() with a stack-allocated buf[BUFLEN] where BUFLEN = 512, with no extra room for the null terminator.

- Function: pnmscanner_gettoken()
- File: plug-ins/common/file-pnm.c:2103-2122
- Fix: https://gitlab.gnome.org/GNOME/gimp/-/commit/83699817
- Upstream issue: https://gitlab.gnome.org/GNOME/gimp/-/issues/16206
- Acknowledgment: bb1abu