Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 183676

Summary: CVE-2006-0747 Freetype integer underflow (CVE-2006-2661)
Product: Red Hat Enterprise Linux 4 Reporter: Josh Bressers <bressers>
Component: freetypeAssignee: Carl Worth (Ampere) <cworth>
Status: CLOSED ERRATA QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: eric.eisenhart, mbarnes, rstrode, security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: source=redhat,reported=20060302,embargo=yes,impact=moderate
Fixed In Version: RHSA-2006-0500 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-18 10:05:06 UTC 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 Josh Bressers 2006-03-02 19:20:00 UTC
Freetype integer underflow

While fuzzing some pdf files a few weeks back, I ended up finding an
integer underflow in freetype2.  Upstream did commit some fixes, so
this issue is somewhat public.

1.ttf will generate this error.

Patches:
http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/pshinter/pshglob.c?r1=1.30&r2=1.31&makepatch=1&diff_format=h
http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/cff/cffload.c?r1=1.73&r2=1.74&makepatch=1&diff_format=h
http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/type1/t1load.c?r1=1.104&r2=1.105&makepatch=1&diff_format=h

The problem is the number of blue values needs to be even.  If a font
file claims it's odd, freetype2 doesn't handle it well.


The crash is seen in src/pshinter/pshglob.c:psh_blues_set_zones_0()

What was basically happening is since read_count is an unsigned
integer, and is decremented by 2, it is possible to cause an integer
underflow by ensuring the value of read_count is an odd number.  Once
read_count underflows, the loop starts dumping garbage onto the heap.
Normally I wouldn't think this is exploitable as it should crash
before anything exciting can happen, most graphical applications are
multi-threaded, so this does worry me.  At the very least this issue
is a denial of service bug.

The 2.ttf file in the testcase will also trigger a NULL pointer
dereference, which I'm not considering a secuirty issue.  The patch is
here:

http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/base/ftutil.c?r1=1.17&r2=1.18&makepatch=1&diff_format=h


This issue also affects RHEL3
This issue also affects RHEL2.1

Comment 1 Josh Bressers 2006-03-02 19:22:34 UTC
attachment 125556 [details] contains the testcase

Comment 2 Matthew Barnes 2006-05-05 21:35:48 UTC
RHEL 3 and RHEL 4 packages are built, will do RHEL 2.1 next week.

Comment 3 Matthew Barnes 2006-05-10 19:19:45 UTC
RHEL 2.1 packages are built.

Comment 4 Josh Bressers 2006-05-15 18:00:44 UTC
Lifting embargo

Comment 5 Josh Bressers 2006-05-30 19:02:59 UTC
The NULL pointer dereference has been assigned CVE-2006-2661

Comment 7 Red Hat Bugzilla 2006-07-18 10:05:06 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.

http://rhn.redhat.com/errata/RHSA-2006-0500.html