bugThe FreeType Project - Bugs: bug #43679, FreeType 2.5.3 TrueType parsing...

 
 

bug #43679: FreeType 2.5.3 TrueType parsing heap-based out-of-bounds read in "tt_face_load_hdmx"

Submitted by:  Mateusz Jurczyk <j00ru>
Submitted on:  Mon 24 Nov 2014 08:21:02 AM UTC  
 
Severity:  3 - Normal Item Group:  Crash
Status:  Fixed Privacy:  Public
Assigned to:  Werner LEMBERG <wl> Open/Closed:  Closed
Planned Release:  2.5.4

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Mon 24 Nov 2014 09:24:15 AM UTC, comment #1: 

Fixed in git, thanks!

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 24 Nov 2014 08:21:02 AM UTC, original submission:  

The following heap-based out-of-bounds memory read has been encountered in FreeType while fuzzing TrueType fonts. It has been reproduced with the current version of freetype2 from master git branch, with a 64-bit build of the ftbench utility compiled with AddressSanitizer:

$ ftbench <file>

Attached are three POC files which trigger the condition.

=================================================================
==12266==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000ecf8 at pc 0x5c42ea bp 0x7fffa2fe67d0 sp 0x7fffa2fe67c8
READ of size 1 at 0x60200000ecf8 thread T0
    #0 0x5c42e9 in tt_face_load_hdmx freetype2/src/truetype/ttpload.c:540
    #1 0x55f2b4 in tt_face_init freetype2/src/truetype/ttobjs.c:570
    #2 0x4cc13e in open_face freetype2/src/base/ftobjs.c:1191
    #3 0x4c794b in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #4 0x4c5b58 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #5 0x491533 in get_face ft2demos-2.5.3/src/ftbench.c:705
    #6 0x48d748 in main ft2demos-2.5.3/src/ftbench.c:924

0x60200000ecf8 is located 0 bytes to the right of 8-byte region [0x60200000ecf0,0x60200000ecf8)
allocated by thread T0 here:
    #0 0x472081 in __interceptor_malloc (ft2demos-2.5.3/bin/ftbench+0x472081)
    #1 0xaf3a2f in ft_alloc freetype2/src/base/ftsystem.c:74
    #2 0x526b21 in ft_mem_qalloc freetype2/src/base/ftutil.c:76
    #3 0x525591 in FT_Stream_EnterFrame freetype2/src/base/ftstream.c:267
    #4 0x524d51 in FT_Stream_ExtractFrame freetype2/src/base/ftstream.c:200
    #5 0x5c3448 in tt_face_load_hdmx freetype2/src/truetype/ttpload.c:500
    #6 0x55f2b4 in tt_face_init freetype2/src/truetype/ttobjs.c:570
    #7 0x4cc13e in open_face freetype2/src/base/ftobjs.c:1191
    #8 0x4c794b in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #9 0x4c5b58 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #10 0x491533 in get_face ft2demos-2.5.3/src/ftbench.c:705
    #11 0x48d748 in main ft2demos-2.5.3/src/ftbench.c:924

SUMMARY: AddressSanitizer: heap-buffer-overflow freetype2/src/truetype/ttpload.c:540 tt_face_load_hdmx
Shadow bytes around the buggy address:
  0x0c047fff9d40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9d50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9d60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9d70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa 00[fa]
  0x0c047fff9da0: fa fa 00 fa fa fa 00 06 fa fa 00 01 fa fa 00 00
  0x0c047fff9db0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fd
  0x0c047fff9dc0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
  0x0c047fff9dd0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
  0x0c047fff9de0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==12266==ABORTING

Mateusz Jurczyk <j00ru>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-11-24 wl StatusNone => Fixed
        PrivacyPrivate => Public
        Assigned toNone => wl
        Open/ClosedOpen => Closed
        Planned ReleaseNone => 2.5.4
    2014-11-24 j00ru Attached File- => Added asan_heap-oob_5c42ea_1115_cov_3509873962_2821502151863019799.bin, #32533

    Back to the top


    Powered by Savane 3.5