https://bugzilla.redhat.com/show_bug.cgi?id=2576973
Bug ID: 2576973
Summary: CVE-2026-109909 libXfont: PCF Font Parsing Negative
Skip Out-Of-Bounds Read [fedora-all]
Product: Fedora
Version: rawhide
Status: NEW
Whiteboard: {"flaws": ["e78debd9-4be6-4c7b-9fd7-04976433ad06"]}
Component: libXfont
Keywords: Security, SecurityTracking
Severity: medium
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected], [email protected],
[email protected],
[email protected], [email protected]
Target Milestone: ---
Classification: Fedora
Disclaimer: Community trackers are created by Red Hat Product Security team on
a best effort basis. Package maintainers are required to ascertain if the flaw
indeed affects their package, before starting the update process.
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 <[email protected]>
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
--
You are receiving this mail because:
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2576973
Report this comment as SPAM:
https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202576973%23c0
--
_______________________________________________
fonts-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it:
https://forge.fedoraproject.org/infra/tickets/issues/new