bugThe FreeType Project - Bugs: bug #35608, Memory corruption in T1_Open_Face...

 
 

bug #35608: Memory corruption in T1_Open_Face / T1_Get_Private_Dict (out-of-bounds write)

Submitted by:  Mateusz Jurczyk <j00ru>
Submitted on:  Thu 23 Feb 2012 01:37:47 PM UTC  
 
Severity: 3 - NormalItem Group: Crash
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.4.9

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sun 26 Feb 2012 07:19:54 AM UTC, comment #1:

Fixed in git, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 23 Feb 2012 01:37:47 PM UTC, original submission:

Crash tested with ftbench, compiled under Ubuntu amd64 with AddressSanitizer (http://code.google.com/p/address-sanitizer/).

Log from ASAN build:

=================================================================
==3842== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f84e675b781 at pc 0x4e5c16 bp 0x7fff46aa35f0 sp 0x7fff46aa35e8
WRITE of size 1 at 0x7f84e675b781 thread T0
#0 0x4e5c16 T1_Get_Private_Dict
#1 0x4e24ef T1_Open_Face
#2 0x4dbb2b T1_Face_Init
#3 0x4913e0 open_face
#4 0x4909a3 FT_Open_Face
#5 0x48fd06 FT_New_Face
#6 0x487557 get_face
#7 0x487cb1 main
#8 0x7f84e67b8d5d __libc_start_main
0x7f84e675b781 is located 0 bytes to the right of 1-byte region [0x7f84e675b780,0x7f84e675b781)
allocated by thread T0 here:
#0 0x5c3222 malloc
#1 0x4a0434 ft_mem_qalloc
#2 0x48b3cf ft_mem_alloc
#3 0x4e540c T1_Get_Private_Dict
#4 0x4e24ef T1_Open_Face
#5 0x4dbb2b T1_Face_Init
#6 0x4913e0 open_face
#7 0x4909a3 FT_Open_Face
#8 0x48fd06 FT_New_Face
#9 0x487557 get_face
#10 0x487cb1 main
#11 0x7f84e67b8d5d __libc_start_main
==3842== ABORTING
Stats: 0M malloced (0M for red zones) by 695 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 11 calls
Stats: 0M really freed by 0 calls
Stats: 24M (6146 full pages) mmaped in 6 calls
mmaps by size class: 8:16383; 9:8191; 10:4095; 11:2047; 12:1024; 15:128;
mallocs by size class: 8:665; 9:16; 10:3; 11:5; 12:5; 15:1;
frees by size class: 8:7; 10:1; 11:2; 12:1;
rfrees by size class:
Stats: malloc large: 0 small slow: 7
Shadow byte and word:
0x1ff09cceb6f0: 1
0x1ff09cceb6f0: 01 fb fb fb fb fb fb fb
More shadow bytes:
0x1ff09cceb6d0: 05 fb fb fb fb fb fb fb
0x1ff09cceb6d8: fb fb fb fb fb fb fb fb
0x1ff09cceb6e0: fa fa fa fa fa fa fa fa
0x1ff09cceb6e8: fa fa fa fa fa fa fa fa
=>0x1ff09cceb6f0: 01 fb fb fb fb fb fb fb
0x1ff09cceb6f8: fb fb fb fb fb fb fb fb
0x1ff09cceb700: fa fa fa fa fa fa fa fa
0x1ff09cceb708: fa fa fa fa fa fa fa fa
0x1ff09cceb710: fa fa fa fa fa fa fa fa

Log from Valgrind:

==3829== Memcheck, a memory error detector
==3829== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==3829== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==3829== Command: ./a.out tmp/freetype/cmbx10.pfb.asan.16.354
==3829==
==3829== Invalid write of size 1
==3829== at 0x41DFDA: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:472)
==3829== by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==3829== by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==3829== by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==3829== by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==3829== by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==3829== by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==3829== Address 0x53d88f1 is 0 bytes after a block of size 1 alloc'd
==3829== at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==3829== by 0x406CBF: ft_mem_qalloc (freetype2/freetype-2.4.8/src/base/ftutil.c:76)
==3829== by 0x4082D2: ft_mem_alloc (freetype2/freetype-2.4.8/src/base/ftutil.c:55)
==3829== by 0x41DF13: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:307)
==3829== by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==3829== by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==3829== by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==3829== by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==3829== by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==3829== by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==3829==
==3829== Invalid write of size 1
==3829== at 0x41DFE6: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:473)
==3829== by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==3829== by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==3829== by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==3829== by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==3829== by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==3829== by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==3829== Address 0x53d88f2 is 1 bytes after a block of size 1 alloc'd
==3829== at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==3829== by 0x406CBF: ft_mem_qalloc (freetype2/freetype-2.4.8/src/base/ftutil.c:76)
==3829== by 0x4082D2: ft_mem_alloc (freetype2/freetype-2.4.8/src/base/ftutil.c:55)
==3829== by 0x41DF13: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:307)
==3829== by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==3829== by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==3829== by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==3829== by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==3829== by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==3829== by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==3829==
==3829== Invalid write of size 1
==3829== at 0x41DFF2: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:474)
==3829== by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==3829== by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==3829== by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==3829== by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==3829== by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==3829== by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==3829== Address 0x53d88f3 is 2 bytes after a block of size 1 alloc'd
==3829== at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==3829== by 0x406CBF: ft_mem_qalloc (freetype2/freetype-2.4.8/src/base/ftutil.c:76)
==3829== by 0x4082D2: ft_mem_alloc (freetype2/freetype-2.4.8/src/base/ftutil.c:55)
==3829== by 0x41DF13: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:307)
==3829== by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==3829== by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==3829== by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==3829== by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==3829== by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==3829== by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==3829==
couldn't load font resource
==3829==
==3829== HEAP SUMMARY:
==3829== in use at exit: 0 bytes in 0 blocks
==3829== total heap usage: 57 allocs, 57 frees, 38,087 bytes allocated
==3829==
==3829== All heap blocks were freed -- no leaks are possible
==3829==
==3829== For counts of detected and suppressed errors, rerun with: -v
==3829== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 4 from 4)

Mateusz Jurczyk <j00ru>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #25148:  cmbx10.pfb.asan.16.354 added by j00ru (34kB - application/octet-stream)
file #25149:  cmssq8.pfb.asan.29.373 added by j00ru (27kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wl (Updated the item)
  • -unavailable- added by j00ru (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 26 Feb 2012 07:19:54 AM UTCwlStatusNone=>Fixed
      PrivacyPrivate=>Public
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.4.9
    Sat 25 Feb 2012 01:23:45 PM UTCwlAssigned toNone=>wl
    Thu 23 Feb 2012 01:37:47 PM UTCj00ruAttached File-=>Added cmbx10.pfb.asan.16.354, #25148
      Attached File-=>Added cmssq8.pfb.asan.29.373, #25149

    Back to the top


    Powered by Savane 3.1-cleanup