bugThe FreeType Project - Bugs: bug #41696, Out-of-bounds reads in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #41696: Out-of-bounds reads in tt_cmap{0,2,4}_validate

Submitter:  Mateusz Jurczyk <j00ru>
Submitted:  Tue 25 Feb 2014 08:31:27 PM UTC
   
 
Severity:  3 - Normal Item Group:  Crash
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.5.3

Wed 26 Feb 2014 06:51:06 PM UTC, comment #1: 

Fixed in git.  Thanks for the report!

Werner LEMBERG <wl>
Group administrator
Tue 25 Feb 2014 08:31:27 PM UTC, original submission:  

Tested on Ubuntu AMD64 with upstream FreeType2 and FreeType2-demos using ./ftbench <file>:

=================================================================
==30177==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200000be42 at pc 0x7fe796 bp 0x7fff2e47b190 sp 0x7fff2e47b188
READ of size 1 at 0x61200000be42 thread T0
    #0 0x7fe795 in tt_cmap0_validate freetype2/src/sfnt/ttcmap.c:92
    #1 0x87bf1e in tt_face_build_cmaps freetype2/src/sfnt/ttcmap.c:3503
    #2 0x83f2cd in sfnt_load_face freetype2/src/sfnt/sfobjs.c:1295
    #3 0x54cdf5 in tt_face_init freetype2/src/truetype/ttobjs.c:563
    #4 0x4c95ce in open_face freetype2/src/base/ftobjs.c:1191
    #5 0x4c57cd in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #6 0x4c3ca4 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #7 0x491d0f in get_face freetype2-demos/src/ftbench.c:705
    #8 0x48e6c4 in main freetype2-demos/src/ftbench.c:924

0x61200000be42 is located 0 bytes to the right of 258-byte region [0x61200000bd40,0x61200000be42)
allocated by thread T0 here:
    #0 0x474821 in __interceptor_malloc llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74
    #1 0xa6611f in ft_alloc freetype2/src/base/ftsystem.c:74
    #2 0x519409 in ft_mem_qalloc freetype2/src/base/ftutil.c:76
    #3 0x518121 in FT_Stream_EnterFrame freetype2/src/base/ftstream.c:267
    #4 0x517a05 in FT_Stream_ExtractFrame freetype2/src/base/ftstream.c:200
    #5 0x844e6e in tt_face_load_cmap freetype2/src/sfnt/ttload.c:922
    #6 0x83b126 in sfnt_load_face freetype2/src/sfnt/sfobjs.c:1046
    #7 0x54cdf5 in tt_face_init freetype2/src/truetype/ttobjs.c:563
    #8 0x4c95ce in open_face freetype2/src/base/ftobjs.c:1191
    #9 0x4c57cd in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #10 0x4c3ca4 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #11 0x491d0f in get_face freetype2-demos/src/ftbench.c:705
    #12 0x48e6c4 in main freetype2-demos/src/ftbench.c:924

SUMMARY: AddressSanitizer: heap-buffer-overflow freetype2/src/sfnt/ttcmap.c:92 tt_cmap0_validate
Shadow bytes around the buggy address:
  0x0c247fff9770: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9780: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9790: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff97a0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff97b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c247fff97c0: 00 00 00 00 00 00 00 00[02]fa fa fa fa fa fa fa
  0x0c247fff97d0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff97e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c247fff97f0: 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa
  0x0c247fff9800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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[==30177==ABORTING

=================================================================
==30858==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61700000ff18 at pc 0x80233d bp 0x7fff69711cb0 sp 0x7fff69711ca8
READ of size 1 at 0x61700000ff18 thread T0
    #0 0x80233c in tt_cmap2_validate freetype2/src/sfnt/ttcmap.c:283
    #1 0x87bf1e in tt_face_build_cmaps freetype2/src/sfnt/ttcmap.c:3503
    #2 0x83f2cd in sfnt_load_face freetype2/src/sfnt/sfobjs.c:1295
    #3 0x54cdf5 in tt_face_init freetype2/src/truetype/ttobjs.c:563
    #4 0x4c95ce in open_face freetype2/src/base/ftobjs.c:1191
    #5 0x4c57cd in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #6 0x4c3ca4 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #7 0x491d0f in get_face freetype2-demos/src/ftbench.c:705
    #8 0x48e6c4 in main freetype2-demos/src/ftbench.c:924

0x61700000ff18 is located 0 bytes to the right of 664-byte region [0x61700000fc80,0x61700000ff18)
allocated by thread T0 here:
    #0 0x474821 in __interceptor_malloc llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74
    #1 0xa6611f in ft_alloc freetype2/src/base/ftsystem.c:74
    #2 0x519409 in ft_mem_qalloc freetype2/src/base/ftutil.c:76
    #3 0x518121 in FT_Stream_EnterFrame freetype2/src/base/ftstream.c:267
    #4 0x517a05 in FT_Stream_ExtractFrame freetype2/src/base/ftstream.c:200
    #5 0x844e6e in tt_face_load_cmap freetype2/src/sfnt/ttload.c:922
    #6 0x83b126 in sfnt_load_face freetype2/src/sfnt/sfobjs.c:1046
    #7 0x54cdf5 in tt_face_init freetype2/src/truetype/ttobjs.c:563
    #8 0x4c95ce in open_face freetype2/src/base/ftobjs.c:1191
    #9 0x4c57cd in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #10 0x4c3ca4 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #11 0x491d0f in get_face freetype2-demos/src/ftbench.c:705
    #12 0x48e6c4 in main freetype2-demos/src/ftbench.c:924

SUMMARY: AddressSanitizer: heap-buffer-overflow freetype2/src/sfnt/ttcmap.c:283 tt_cmap2_validate
Shadow bytes around the buggy address:
  0x0c2e7fff9f90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff9fa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff9fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff9fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2e7fff9fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c2e7fff9fe0: 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fff9ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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 ==30858==ABORTING


=================================================================
==30879==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200000bcf7 at pc 0x805f33 bp 0x7fff2189b470 sp 0x7fff2189b468
READ of size 1 at 0x61200000bcf7 thread T0
    #0 0x805f32 in tt_cmap4_validate freetype2/src/sfnt/ttcmap.c:822
    #1 0x87bf1e in tt_face_build_cmaps freetype2/src/sfnt/ttcmap.c:3503
    #2 0x83f2cd in sfnt_load_face freetype2/src/sfnt/sfobjs.c:1295
    #3 0x54cdf5 in tt_face_init freetype2/src/truetype/ttobjs.c:563
    #4 0x4c95ce in open_face freetype2/src/base/ftobjs.c:1191
    #5 0x4c57cd in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #6 0x4c3ca4 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #7 0x491d0f in get_face freetype2-demos/src/ftbench.c:705
    #8 0x48e6c4 in main freetype2-demos/src/ftbench.c:924

0x61200000bcf7 is located 0 bytes to the right of 311-byte region [0x61200000bbc0,0x61200000bcf7)
allocated by thread T0 here:
    #0 0x474821 in __interceptor_malloc llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74
    #1 0xa6611f in ft_alloc freetype2/src/base/ftsystem.c:74
    #2 0x519409 in ft_mem_qalloc freetype2/src/base/ftutil.c:76
    #3 0x518121 in FT_Stream_EnterFrame freetype2/src/base/ftstream.c:267
    #4 0x517a05 in FT_Stream_ExtractFrame freetype2/src/base/ftstream.c:200
    #5 0x844e6e in tt_face_load_cmap freetype2/src/sfnt/ttload.c:922
    #6 0x83b126 in sfnt_load_face freetype2/src/sfnt/sfobjs.c:1046
    #7 0x54cdf5 in tt_face_init freetype2/src/truetype/ttobjs.c:563
    #8 0x4c95ce in open_face freetype2/src/base/ftobjs.c:1191
    #9 0x4c57cd in FT_Open_Face freetype2/src/base/ftobjs.c:2123
    #10 0x4c3ca4 in FT_New_Face freetype2/src/base/ftobjs.c:1254
    #11 0x491d0f in get_face freetype2-demos/src/ftbench.c:705
    #12 0x48e6c4 in main freetype2-demos/src/ftbench.c:924

SUMMARY: AddressSanitizer: heap-buffer-overflow freetype2/src/sfnt/ttcmap.c:822 tt_cmap4_validate
Shadow bytes around the buggy address:
  0x0c247fff9740: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9750: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9760: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9770: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff9780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c247fff9790: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[07]fa
  0x0c247fff97a0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff97b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c247fff97c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c247fff97d0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff97e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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:      =30879==ABORTING

Mateusz Jurczyk <j00ru>
Group Member

 

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

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-26 wl StatusNone Fixed
        PrivacyPrivate Public
        Assigned toNone wl
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.5.3
    2014-02-25 j00ru Attached File- Added asan_heap-oob_849972_9059_cov_3792063058_quantfh.ttf, #30698
        Attached File- Added asan_heap-oob_8458ac_8915_cov_1416639713_obstacll.ttf, #30699
        Attached File- Added asan_heap-oob_841be0_3827_cov_2177390255_clR5x8.otb, #30700

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code