bugThe FreeType Project - Bugs: bug #30236, NULL-ptr deref. in...

 
 

bug #30236: NULL-ptr deref. in sfnt/ttcmap.c:3403 due to invalid (uninitialized?) face->cmap_table

Submitted by:  Robert Swiecki <jagger>
Submitted on:  Wed 23 Jun 2010 04:35:16 PM UTC  
 
Severity: 3 - NormalItem Group: Crash
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.13

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 24 Jun 2010 06:48:42 AM UTC, comment #1:

Fixed in git, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Wed 23 Jun 2010 04:35:16 PM UTC, original submission:

gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)

Font: http://alt.swiecki.net/j/f/sigsegv14.otf

compiled with "-O0 -m32 -g"

$ gdb ./ftbench

(gdb) r -c 1 sigsegv14.otf

The face->cmap_table never gets initialized. The first time it appears is in /usr/local/google/src/freetype2/src/cff/cffobjs.c:439

439 CFF_Face face = (CFF_Face)cffface;

This assignment is "suspicious" as both types are pointers to completely different structures, but even if the whole 'face' gets reinitialized later on, the face->cmap_table is never set to anything else than 0x0.

Program received signal SIGSEGV, Segmentation fault.
0x0808e067 in tt_face_build_cmaps (face=0x80d2e00) at /usr/local/google/src/freetype2/src/sfnt/ttcmap.c:3403
3403 if ( TT_NEXT_USHORT( p ) != 0 )

(gdb) p p
$1 = (FT_Byte * volatile) 0x2 <Address 0x2 out of bounds>

(gdb) bt
#0 0x0808e067 in tt_face_build_cmaps (face=0x80d2e00) at /usr/local/google/src/freetype2/src/sfnt/ttcmap.c:3403
#1 0x0808fa5f in sfnt_load_face (stream=0x80d2dd0, face=0x80d2e00, face_index=0, num_params=0, params=0x0) at /usr/local/google/src/freetype2/src/sfnt/sfobjs.c:857
#2 0x08070176 in cff_face_init (stream=0x80d2dd0, cffface=0x80d2e00, face_index=0, num_params=0, params=0x0) at /usr/local/google/src/freetype2/src/cff/cffobjs.c:495
#3 0x0804d0c6 in open_face (driver=0x80d26b8, stream=0x80d2dd0, face_index=0, num_params=0, params=0x0, aface=0xffffd5f8) at /usr/local/google/src/freetype2/src/base/ftobjs.c:1110
#4 0x0804e331 in FT_Open_Face (library=0x80ce020, args=0xffffd630, face_index=0, aface=0xffffd70c) at /usr/local/google/src/freetype2/src/base/ftobjs.c:1995
#5 0x0804d1bb in FT_New_Face (library=0x80ce020, pathname=0xffffd993 "sigsegv14.otf", face_index=0, aface=0xffffd70c) at /usr/local/google/src/freetype2/src/base/ftobjs.c:1172
#6 0x08049995 in get_face (face=0xffffd70c) at /usr/local/google/src/freetype2-demos/src/ftbench.c:615
#7 0x08049c5b in main (argc=1, argv=0xffffd7d0) at /usr/local/google/src/freetype2-demos/src/ftbench.c:739

$ valgrind ./ftbench -c 1 sigsegv14.otf
VALGRIND_MEMORY_LIMIT_IN_MB=4095; VALGRIND_TIMEOUT=3600
==12277== Memcheck, a memory error detector
==12277== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==12277== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info
==12277== Command: ./ftbench -c 1 sigsegv14.otf
==12277==
==12277== Invalid read of size 1
==12277== at 0x808E067: tt_face_build_cmaps /usr/local/google/src/freetype2/src/sfnt/ttcmap.c:3403
==12277== by 0x808FA5E: sfnt_load_face /usr/local/google/src/freetype2/src/sfnt/sfobjs.c:857
==12277== by 0x8070175: cff_face_init /usr/local/google/src/freetype2/src/cff/cffobjs.c:495
==12277== by 0x804D0C5: open_face /usr/local/google/src/freetype2/src/base/ftobjs.c:1110
==12277== by 0x804E330: FT_Open_Face /usr/local/google/src/freetype2/src/base/ftobjs.c:1995
==12277== by 0x804D1BA: FT_New_Face /usr/local/google/src/freetype2/src/base/ftobjs.c:1172
==12277== by 0x8049994: get_face /usr/local/google/src/freetype2-demos/src/ftbench.c:615
==12277== by 0x8049C5A: main /usr/local/google/src/freetype2-demos/src/ftbench.c:739
==12277== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==12277==
==12277==
==12277== Process terminating with default action of signal 11 (SIGSEGV)
==12277== Access not within mapped region at address 0x0
==12277== at 0x808E067: tt_face_build_cmaps /usr/local/google/src/freetype2/src/sfnt/ttcmap.c:3403
==12277== by 0x808FA5E: sfnt_load_face /usr/local/google/src/freetype2/src/sfnt/sfobjs.c:857
==12277== by 0x8070175: cff_face_init /usr/local/google/src/freetype2/src/cff/cffobjs.c:495
==12277== by 0x804D0C5: open_face /usr/local/google/src/freetype2/src/base/ftobjs.c:1110
==12277== by 0x804E330: FT_Open_Face /usr/local/google/src/freetype2/src/base/ftobjs.c:1995
==12277== by 0x804D1BA: FT_New_Face /usr/local/google/src/freetype2/src/base/ftobjs.c:1172
==12277== by 0x8049994: get_face /usr/local/google/src/freetype2-demos/src/ftbench.c:615
==12277== by 0x8049C5A: main /usr/local/google/src/freetype2-demos/src/ftbench.c:739
==12277== If you believe this happened as a result of a stack
==12277== overflow in your program's main thread (unlikely but
==12277== possible), you can try to increase the size of the
==12277== main thread stack using the --main-stacksize= flag.
==12277== The main thread stack size used in this run was 8388608.

Robert Swiecki <jagger>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #20799:  sigsegv14.otf added by jagger (168KiB - application/vnd.oasis.opendocument.formula-template)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wl (Posted a comment)
  • -unavailable- added by jagger (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 24 Jun 2010 06:48:42 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.13
    Wed 23 Jun 2010 04:35:16 PM UTCjaggerAttached File-=>Added sigsegv14.otf, #20799

    Back to the top


    Powered by Savane 3.1-cleanup1