Bug 2572344 (CVE-2026-109909)

Summary: CVE-2026-109909 libxfont: PCF Font Parsing Negative Skip Out-Of-Bounds Read
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, security-response-team, 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 libXfont. A local attacker can exploit this vulnerability by causing an application or display server utilizing the library to load a specially crafted Portable Compiled Format (PCF) font file. Because the library fails to properly validate negative seek counts when parsing font tables, an out-of-bounds read from memory occurs. This issue primarily allows an attacker to cause an application crash, resulting in a Denial of Service (DoS), or potentially disclose sensitive process memory.
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:
Deadline: 2026-11-18   

Description OSIDB Bzimport 2026-11-12 11:47:40 UTC
BufFileRawSkip() in libXfont accepts a signed int count parameter but
does not validate it for negative values. A crafted PCF font file can
supply a table offset that, when subtracted from the current file
position in pcfSeekToType(), wraps to a negative value due to unsigned
to signed integer conversion. The negative count passes the in-buffer
bounds check in BufFileRawSkip() (curoff + count <= fileoff is trivially
true when count is negative) and advances the buffer pointer backward
past the buffer start. Subsequent FontFileGetc() calls then dereference
the corrupted buffer pointer, reading from invalid heap memory or
unmapped pages.

An attacker who can cause the X server or any application using
libXfont to load a malicious PCF font file can trigger an
out-of-bounds heap read, potentially leaking sensitive information
from the process memory space via QueryFont responses, or crash the
process via a segmentation fault.

Fixed in: libXfont2-2.0.10
Fixes:
  - https://gitlab.freedesktop.org/xorg/lib/libxfont/-/commit/TBD

Acknowledgements:
    Elias Myllymki working with TrendAI Zero Day Initiative

* Patch
From f9f25c0c5d1f60ebcdcf9f83fa57bf0ec6cc9a20 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer>
Date: Tue, 3 Nov 2026 15:53:12 +1000
Subject: [PATCH libXfont 1/2] bufio,pcf: reject negative skip count in
 BufFileRawSkip
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

BufFileRawSkip() takes a signed int count but never validates it for
negative values. A crafted PCF font file can have a table offset that,
when subtracted from the current file position, wraps to a negative
value. This negative count passes the buffer bounds check
(curoff + count <= fileoff is trivially true for negative count) and
moves the buffer pointer backward past the buffer start. Subsequent
FontFileGetc() calls then read from invalid memory, causing an
out-of-bounds heap read or a segmentation fault.

Add validation in BufFileRawSkip() to reject negative count values,
returning BUFFILEEOF. Additionally, add defense-in-depth checks in
pcfSeekToType() to validate that the skip distance fits in an int and
that the position is non-negative before calling FontFileSkip.

This vulnerability was discovered by:
  Elias Myllymki working with TrendAI Zero Day Initiative

CVE-2026-109909, ZDI-CAN-33183

Assisted-by: AI


#+begin_src diff
---
 src/bitmap/pcfread.c | 4 +++-
 src/fontfile/bufio.c | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git ./src/bitmap/pcfread.c ../src/bitmap/pcfread.c
index a385331e1d48..e3b6277e1ed5 100644
--- ./src/bitmap/pcfread.c
+++ ../src/bitmap/pcfread.c
@@ -203,17 +203,19 @@ pcfGetCompressedMetric(FontFilePtr file, CARD32 format, xCharInfo *metric)
 static Bool
 pcfSeekToType(FontFilePtr file, PCFTablePtr tables, int ntables,
 	      CARD32 type, CARD32 *formatp, CARD32 *sizep)
 {
     int         i;
 
     for (i = 0; i < ntables; i++)
 	if (tables[i].type == type) {
-	    if (position > tables[i].offset)
+	    if (position < 0 || (CARD32)position > tables[i].offset)
+		return FALSE;
+	    if (tables[i].offset - (CARD32)position > INT_MAX)
 		return FALSE;
 	    if (!FontFileSkip(file, tables[i].offset - position))
 		return FALSE;
 	    position = tables[i].offset;
 	    *sizep = tables[i].size;
 	    *formatp = tables[i].format;
 	    return TRUE;
 	}
diff --git ./src/fontfile/bufio.c ../src/fontfile/bufio.c
index 7465f72cbfe3..8b081e9bf595 100644
--- ./src/fontfile/bufio.c
+++ ../src/fontfile/bufio.c
@@ -82,16 +82,19 @@ BufFileRawFill (BufFilePtr f)
 
 static int
 BufFileRawSkip (BufFilePtr f, int count)
 {
     off_t	curoff;
     off_t	fileoff;
     off_t	todo;
 
+    if (count < 0)
+	return BUFFILEEOF;
+
     curoff = f->bufp - f->buffer;
     fileoff = curoff + f->left;
     if (curoff + count <= fileoff) {
 	f->bufp += count;
 	f->left -= count;
     } else {
 	todo = count - (fileoff - curoff);
 	if (lseek (FileDes(f), todo, SEEK_CUR) == -1) {
-- 
2.56.0

#+end_src