Bug 171073 - CVE-2005-3186 XPM buffer overflow
Summary: CVE-2005-3186 XPM buffer overflow
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gtk2   
(Show other bugs)
Version: 4.0
Hardware: All
OS: Linux
Target Milestone: ---
: ---
Assignee: Matthias Clasen
QA Contact:
Whiteboard: reported=20051013,embargo=20051115,im...
Keywords: Security
Depends On:
TreeView+ depends on / blocked
Reported: 2005-10-17 22:13 UTC by Josh Bressers
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: RHSA-2005-811
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-11-15 14:37:36 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2005:811 normal SHIPPED_LIVE Important: gtk2 security update 2005-11-15 05:00:00 UTC

Description Josh Bressers 2005-10-17 22:13:29 UTC
+++ This bug was initially created as a clone of Bug #171071 +++

iDEFENSE has reported a buffer overflow in the gdk-pixbuf's XPM processor.
(Text taken from the iDEFENSE advisory)


Remote exploitation of heap overflow vulnerability in various vendors'
implementations of the GTK+ gdk-pixbuf XPM image rendering library could
allow for arbitrary code execution. iDEFENSE is currently unaware of
exploits for this vulnerability other than those maintainted by iDEFENSE
Labs, however exploitation is trivial. Vendor patches for this iDEFENSE
exclusive report are currently unavailable. A workaround has been

The vulnerability specifically exists due to an integer overflow while
processing XPM files. The following code snippet illustrates the

if (n_col <= 0 || n_col >= G_MAXINT / (cpp + 1)) {
                g_set_error (error,
                             _("XPM file has invalid number of colors"));
        return NULL;
colors = (XPMColor *) g_try_malloc ((sizeof (XPMColor) * n_col));

The validity check of n_col is enough to prevent an integer overflow in
the first g_try_malloc, however there is not a proper check for the
second g_try_malloc, which allows an undersized heap buffer to be
allocated, then overflowed while using n_col as an upper bounds in a
copying loop. This can be used to execute arbitrary code via traditional
heap overflow 4 byte write methods or by overwriting adjacent areas of
the heap with important values such as function pointers.

-- Additional comment from bressers@redhat.com on 2005-10-17 18:06 EST --
Created an attachment (id=120098)
Proposed patch for this issue.

-- Additional comment from bressers@redhat.com on 2005-10-17 18:07 EST --
This issue should also affect RHEL3

Comment 3 Josh Bressers 2005-11-15 14:09:07 UTC
Lifting embargo

Comment 4 Red Hat Bugzilla 2005-11-15 14:37:36 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.