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

 
 

bug #36705: Out-of-bounds static read in cff_parse_real

Submitted by:  Mateusz Jurczyk <j00ru>
Submitted on:  Fri 22 Jun 2012 09:30:04 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.

 

Tue 26 Jun 2012 11:00:20 AM UTC, comment #2:

Tested, doesn't crash now. Thanks!

Mateusz Jurczyk <j00ru>
Project Member
Mon 25 Jun 2012 09:01:19 AM UTC, comment #1:

Fixed in git, thanks. Please test.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Fri 22 Jun 2012 09:30:04 AM UTC, original submission:

Crash tested with ftbench (+freetype2 git upstream), compiled under Ubuntu amd64 with AddressSanitizer (http://code.google.com/p/address-sanitizer/). Since it's a static oob read, I am afraid this might not be valgrind-detectable.

Log from ASAN build:

=================================================================
==14897== ERROR: AddressSanitizer global-buffer-overflow on address 0x0000006ff7c8 at pc 0x4ff494 bp 0x7fff5e00b100 sp 0x7fff5e00b0f8
READ of size 8 at 0x0000006ff7c8 thread T0
#0 0x4ff494 cff_parse_real
#1 0x4f7508 cff_parse_font_matrix
#2 0x4fe849 cff_parser_run
#3 0x4fbcd8 cff_subfont_load
#4 0x4f973c cff_font_load
#5 0x4f4015 cff_face_init
#6 0x49a662 open_face
#7 0x49948b FT_Open_Face
#8 0x498fda FT_New_Face
#9 0x490804 get_face
#10 0x49105a main
#11 0x7fdb0da45d5d __libc_start_main
0x0000006ff7c8 is located 24 bytes to the left of global variable 'power_tens (freetype2/freetype-2.4.9/src/cff/cff.c)' (0x6ff7e0) of size 80
0x0000006ff7c8 is located 26 bytes to the right of global variable 'cff_expertsubset_charset (freetype2/freetype-2.4.9/src/cff/cff.c)' (0x6ff700) of size 174
==14897== ABORTING
Stats: 0M malloced (0M for red zones) by 713 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 22 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; 13:512; 15:128;
mallocs by size class: 8:682; 9:19; 10:3; 11:6; 13:1; 15:2;
frees by size class: 8:18; 9:1; 10:2; 11:1;
rfrees by size class:
Stats: malloc large: 0 small slow: 7
Shadow byte and word:
0x1000000dfef9: f9
0x1000000dfef8: f9 f9 f9 f9 00 00 00 00
More shadow bytes:
0x1000000dfed8: 00 04 f9 f9 f9 f9 f9 f9
0x1000000dfee0: 00 00 00 00 00 00 00 00
0x1000000dfee8: 00 00 00 00 00 00 00 00
0x1000000dfef0: 00 00 00 00 00 06 f9 f9
=>0x1000000dfef8: f9 f9 f9 f9 00 00 00 00
0x1000000dff00: 00 00 00 00 00 00 f9 f9
0x1000000dff08: f9 f9 f9 f9 00 00 00 00
0x1000000dff10: 00 00 00 03 f9 f9 f9 f9
0x1000000dff18: 00 00 01 f9 f9 f9 f9 f9

A more detailed stack trace:

(gdb) where
[...]
#2 0x00000000004ff494 in cff_parse_real (start=<optimized out>, limit=<optimized out>, power_ten=<optimized out>,
scaling=<optimized out>) at freetype2/freetype-2.4.9/src/cff/cffparse.c:292
#3 0x00000000004f7508 in cff_parse_font_matrix (parser=<optimized out>)
at freetype2/freetype-2.4.9/src/cff/cffparse.c:471
#4 0x00000000004fe849 in cff_parser_run (parser=<optimized out>, start=<optimized out>,
limit=<error reading variable: Unhandled dwarf expression opcode 0x0>)
at freetype2/freetype-2.4.9/src/cff/cffparse.c:1077
#5 0x00000000004fbcd8 in cff_subfont_load (font=<optimized out>, idx=<optimized out>, font_index=<optimized out>,
stream=<error reading variable: Unhandled dwarf expression opcode 0x0>, base_offset=<optimized out>,
library=<error reading variable: Unhandled dwarf expression opcode 0x0>)
at freetype2/freetype-2.4.9/src/cff/cffload.c:1341
#6 0x00000000004f973c in cff_font_load (library=<error reading variable: Unhandled dwarf expression opcode 0x0>,
stream=<error reading variable: Unhandled dwarf expression opcode 0x0>, face_index=<optimized out>,
font=<error reading variable: Unhandled dwarf expression opcode 0x0>,
pure_cff=<error reading variable: Unhandled dwarf expression opcode 0x0>)
at freetype2/freetype-2.4.9/src/cff/cffload.c:1554
#7 0x00000000004f4015 in cff_face_init (stream=<optimized out>, cffface=<optimized out>, face_index=<optimized out>,
num_params=<optimized out>, params=<optimized out>) at freetype2/freetype-2.4.9/src/cff/cffobjs.c:589
#8 0x000000000049a662 in open_face (driver=<error reading variable: Unhandled dwarf expression opcode 0x0>,
stream=<optimized out>, face_index=<optimized out>, num_params=<optimized out>, params=<optimized out>,
aface=<optimized out>) at freetype2/freetype-2.4.9/src/base/ftobjs.c:1153
#9 0x000000000049948b in FT_Open_Face (library=<optimized out>, args=<optimized out>, face_index=<optimized out>,
aface=<optimized out>) at freetype2/freetype-2.4.9/src/base/ftobjs.c:2080
#10 0x0000000000498fda in FT_New_Face (library=<error reading variable: Unhandled dwarf expression opcode 0x0>,
pathname=<optimized out>, face_index=<optimized out>, aface=<error reading variable: Unhandled dwarf expression opcode 0x0>)
at freetype2/freetype-2.4.9/src/base/ftobjs.c:1215
#11 0x0000000000490804 in get_face (face=0x0) at freetype2/ft2demos-2.4.8/src/ftbench.c:624
#12 0x000000000049105a in main (argc=<optimized out>, argv=<optimized out>)
at freetype2/ft2demos-2.4.8/src/ftbench.c:752

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 #26084:  3828307627185124514.bin.asan.70.82 added by j00ru (6KiB - 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
    Mon 25 Jun 2012 09:01:19 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.4.11
    Fri 22 Jun 2012 09:30:04 AM UTCj00ruAttached File-=>Added 3828307627185124514.bin.asan.70.82, #26084

    Back to the top


    Powered by Savane 3.1-cleanup1