bugThe FreeType Project - Bugs: bug #35602, Out-of-bounds read (off-by-one) in...

 
 

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

bug #35602: Out-of-bounds read (off-by-one) in t42_parse_sfnts

Submitter:  Mateusz Jurczyk <j00ru>
Submitted:  Thu 23 Feb 2012 12:46:49 PM UTC
   
 
Severity:  3 - Normal Item Group:  Crash
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.4.9

Sun 26 Feb 2012 07:17:18 AM UTC, comment #1: 

Fixed in git, thanks.

Werner LEMBERG <wl>
Group administrator
Thu 23 Feb 2012 12:46:49 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:

=================================================================
==30387== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f4394a2dc7f at pc 0x580d2a bp 0x7fff0ad4cc30 sp 0x7fff0ad4cc28
READ of size 1 at 0x7f4394a2dc7f thread T0
  #0 0x580d2a t42_parse_sfnts
  #1 0x585f27 t42_load_keyword
  #2 0x58578f t42_parse_dict
  #3 0x58442f T42_Open_Face
  #4 0x5819ba T42_Face_Init
  #5 0x4913e0 open_face
  #6 0x4909a3 FT_Open_Face
  #7 0x48fd06 FT_New_Face
  #8 0x487557 get_face
  #9 0x487cb1 main
  #10 0x7f4394a8ad5d __libc_start_main
0x7f4394a2dc7f is located 1 bytes to the left of 2-byte region [0x7f4394a2dc80,0x7f4394a2dc82)
allocated by thread T0 here:
  #0 0x5c3222 malloc
  #1 0x4a0434 ft_mem_qalloc
  #2 0x48b3cf ft_mem_alloc
  #3 0x4a3012 ft_mem_qrealloc
  #4 0x48bccd ft_mem_realloc
  #5 0x58116e t42_parse_sfnts
  #6 0x585f27 t42_load_keyword
  #7 0x58578f t42_parse_dict
  #8 0x58442f T42_Open_Face
  #9 0x5819ba T42_Face_Init
  #10 0x4913e0 open_face
  #11 0x4909a3 FT_Open_Face
  #12 0x48fd06 FT_New_Face
  #13 0x487557 get_face
  #14 0x487cb1 main
  #15 0x7f4394a8ad5d __libc_start_main
==30387== ABORTING
Stats: 0M malloced (0M for red zones) by 705 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 20 calls
Stats: 0M really freed by 0 calls
Stats: 28M (7171 full pages) mmaped in 7 calls
  mmaps   by size class: 8:16383; 9:8191; 10:4095; 11:2047; 12:1024; 13:512; 15:128;
  mallocs by size class: 8:670; 9:16; 10:6; 11:6; 12:5; 13:1; 15:1;
  frees   by size class: 8:11; 10:4; 11:3; 12:1; 13:1;
  rfrees  by size class:
Stats: malloc large: 0 small slow: 8
Shadow byte and word:
  0x1fe872945b8f: fa
  0x1fe872945b88: fa fa fa fa fa fa fa fa
More shadow bytes:
  0x1fe872945b68: fa fa fa fa fa fa fa fa
  0x1fe872945b70: 05 fb fb fb fb fb fb fb
  0x1fe872945b78: fb fb fb fb fb fb fb fb
  0x1fe872945b80: fa fa fa fa fa fa fa fa
=>0x1fe872945b88: fa fa fa fa fa fa fa fa
  0x1fe872945b90: 02 fb fb fb fb fb fb fb
  0x1fe872945b98: fb fb fb fb fb fb fb fb
  0x1fe872945ba0: fa fa fa fa fa fa fa fa
  0x1fe872945ba8: fa fa fa fa fa fa fa fa


Log from Valgrind:

==30243== Memcheck, a memory error detector
==30243== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==30243== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==30243== Command: ./a.out tmp/freetype/8bitlim.t42.asan.6a.66
==30243==
==30243== Invalid read of size 1
==30243==    at 0x42CB06: t42_parse_sfnts (freetype2/freetype-2.4.8/src/type42/t42parse.c:611)
==30243==    by 0x42E122: T42_Face_Init (freetype2/freetype-2.4.8/src/type42/t42parse.c:981)
==30243==    by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==30243==    by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==30243==    by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==30243==    by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==30243==    by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==30243==  Address 0x53db1df is 1 bytes before a block of size 2 alloc'd
==30243==    at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==30243==    by 0x406CBF: ft_mem_qalloc (freetype2/freetype-2.4.8/src/base/ftutil.c:76)
==30243==    by 0x4082D2: ft_mem_alloc (freetype2/freetype-2.4.8/src/base/ftutil.c:55)
==30243==    by 0x408404: ft_mem_qrealloc (freetype2/freetype-2.4.8/src/base/ftutil.c:145)
==30243==    by 0x408CCA: ft_mem_realloc (freetype2/freetype-2.4.8/src/base/ftutil.c:101)
==30243==    by 0x42CDCB: t42_parse_sfnts (freetype2/freetype-2.4.8/src/type42/t42parse.c:558)
==30243==    by 0x42E122: T42_Face_Init (freetype2/freetype-2.4.8/src/type42/t42parse.c:981)
==30243==    by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==30243==    by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==30243==    by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==30243==    by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==30243==    by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==30243==
couldn't load font resource
==30243==
==30243== HEAP SUMMARY:
==30243==     in use at exit: 0 bytes in 0 blocks
==30243==   total heap usage: 67 allocs, 67 frees, 46,917 bytes allocated
==30243==
==30243== All heap blocks were freed -- no leaks are possible
==30243==
==30243== For counts of detected and suppressed errors, rerun with: -v
==30243== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

Mateusz Jurczyk <j00ru>
Group Member

 

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

Attached Files
file #25135:  8bitlim.t42.asan.6a.66 added by j00ru (18KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-02-26 wl StatusNone Fixed
        PrivacyPrivate Public
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.4.9
    2012-02-25 wl Assigned toNone wl
    2012-02-23 j00ru Attached File- Added 8bitlim.t42.asan.6a.66, #25135
        Carbon-Copy- Added j00ru

    Back to the top

    Powered by Savane 3.13-54b4.
    Corresponding source code