bugThe FreeType Project - Bugs: bug #36829, Out-of-bounds read in...

 
 

bug #36829: Out-of-bounds read in ps_table_release

Submitted by:  Mateusz Jurczyk <j00ru>
Submitted on:  Wed 11 Jul 2012 11:56:31 AM UTC  
 
Severity: 3 - NormalItem Group: Crash
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.4.11

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 18 Jul 2012 08:41:11 AM UTC, comment #1:

Fixed in git, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Wed 11 Jul 2012 11:56:31 AM UTC, original submission:

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

Command line used: $ ftbench -p <font file> (the memory preload option is required here.)

Log from AddressSanitizer:

--- cut ---
=================================================================
==998== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f1b5a90b6bd at pc 0x5a54a0 bp 0x7fff56d7fb00 sp 0x7fff56d7faf8
READ of size 1 at 0x7f1b5a90b6bd thread T0
#0 0x5a54a0 ps_table_release
#1 0x4def4e parse_encoding
#2 0x4eeb26 t1_load_keyword
#3 0x4ecac6 parse_dict
#4 0x4ea31f T1_Open_Face
#5 0x4e3ab4 T1_Face_Init
#6 0x49a672 open_face
#7 0x49946b FT_Open_Face
#8 0x49a2fa FT_New_Memory_Face
#9 0x4907c4 get_face
#10 0x49104d main
#11 0x7f1b5b560d5d __libc_start_main
0x7f1b5a90b6bd is located 0 bytes to the right of 1597-byte region [0x7f1b5a90b080,0x7f1b5a90b6bd)
allocated by thread T0 here:
#0 0x5c85a2 __interceptor_malloc
#1 0x4906f5 get_face
#2 0x49104d main
#3 0x7f1b5b560d5d __libc_start_main
==998== ABORTING
Stats: 0M malloced (0M for red zones) by 714 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 20 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:682; 9:16; 10:4; 11:6; 12:5; 15:1;
frees by size class: 8:16; 10:1; 11:2; 12:1;
rfrees by size class:
Stats: malloc large: 0 small slow: 7
Shadow byte and word:
0x1fe36b5216d7: 5
0x1fe36b5216d0: 00 00 00 00 00 00 00 05
More shadow bytes:
0x1fe36b5216b0: 00 00 00 00 00 00 00 00
0x1fe36b5216b8: 00 00 00 00 00 00 00 00
0x1fe36b5216c0: 00 00 00 00 00 00 00 00
0x1fe36b5216c8: 00 00 00 00 00 00 00 00
=>0x1fe36b5216d0: 00 00 00 00 00 00 00 05
0x1fe36b5216d8: fb fb fb fb fb fb fb fb
0x1fe36b5216e0: fa fa fa fa fa fa fa fa
0x1fe36b5216e8: fa fa fa fa fa fa fa fa
0x1fe36b5216f0: fa fa fa fa fa fa fa fa
--- cut ---

A more detailed stack trace:

--- cut ---
(gdb) where
#0 __asan::__asan_report_load1 (addr=140737328412349) at address_sanitizer/asan/asan_rtl.cc:241
#1 0x00000000005a54a0 in ps_table_add (table=<optimized out>, idx=<optimized out>, object=<optimized out>,
length=<optimized out>) at freetype2/freetype-2.4.9/src/psaux/psobjs.c:216
#2 0x00000000004def4e in parse_encoding (face=0x7ffff6b86480, loader=0x7fffffffd6e0)
at freetype2/freetype-2.4.9/src/type1/t1load.c:1301
#3 0x00000000004eeb26 in t1_load_keyword (face=0x7ffff67776bd, loader=0x48d833, field=<optimized out>)
at freetype2/freetype-2.4.9/src/type1/t1load.c:937
#4 0x00000000004ecac6 in parse_dict (face=0x7ffff6b86480, loader=0x7fffffffd6e0, base=<optimized out>, size=<optimized out>)
at freetype2/freetype-2.4.9/src/type1/t1load.c:1994
#5 0x00000000004ea31f in T1_Open_Face (face=0x7fffffffd5f0) at freetype2/freetype-2.4.9/src/type1/t1load.c:2102
#6 0x00000000004e3ab4 in T1_Face_Init (stream=<optimized out>, t1face=0x7fffffffda50, face_index=4857017, num_params=5,
params=0x3) at freetype2/freetype-2.4.9/src/type1/t1objs.c:339
#7 0x000000000049a672 in open_face (driver=0x7ffff736e980, stream=0x7ffff7370080, face_index=0, num_params=0, params=0x0,
aface=0x7fffffffde20) at freetype2/freetype-2.4.9/src/base/ftobjs.c:1153
#8 0x000000000049946b in FT_Open_Face (library=0x7ffff6f86880, args=0x7fffffffdf20, face_index=0, aface=0x7fffffffe0a0)
at freetype2/freetype-2.4.9/src/base/ftobjs.c:2080
#9 0x000000000049a2fa in FT_New_Memory_Face (library=0x7ffff67776bd, file_base=<optimized out>, file_size=<optimized out>,
face_index=<optimized out>, aface=0x3) at freetype2/freetype-2.4.9/src/base/ftobjs.c:1242
#10 0x00000000004907c4 in get_face (face=0x7f3420) at freetype2/ft2demos-2.4.8/src/ftbench.c:621
#11 0x000000000049104d in main (argc=<optimized out>, argv=<optimized out>)
at freetype2/ft2demos-2.4.8/src/ftbench.c:752
--- cut ---

The issue has also been confirmed to be detectable with valgrind. Sample file attached.

Mateusz Jurczyk <j00ru>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #26180:  font.bin added by j00ru (2KiB - 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 (Posted a comment)
  • -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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 18 Jul 2012 08:41:11 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.4.11
    Wed 11 Jul 2012 11:56:31 AM UTCj00ruAttached File-=>Added font.bin, #26180

    Back to the top


    Powered by Savane 3.1-cleanup1