bugThe FreeType Project - Bugs: bug #35640, Out-of-bounds read in TT_RunIns

 
 

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

bug #35640: Out-of-bounds read in TT_RunIns

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

Thu 01 Mar 2012 08:30:44 PM UTC, comment #1: 

Fixed in git, thanks.

Werner LEMBERG <wl>
Group administrator
Mon 27 Feb 2012 12:06:49 PM UTC, original submission:  

Crash tested with ftbench (current git branch of freetype2 and ft2demos), compiled under Ubuntu amd64 with AddressSanitizer (http://code.google.com/p/address-sanitizer/).

Crashlog:

Load                      : =================================================================
==17149== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f7db9086d28 at pc 0x4ab9b1 bp 0x7fffc6111290 sp 0x7fffc6111288
READ of size 1 at 0x7f7db9086d28 thread T0
  #0 0x4ab9b1 TT_RunIns
  #1 0x4cead9 TT_Hint_Glyph
  #2 0x4cc9bd TT_Process_Simple_Glyph
  #3 0x4c7ec5 load_truetype_glyph
  #4 0x4c578b TT_Load_Glyph
  #5 0x48934c FT_Load_Glyph
  #6 0x485be3 test_load
  #7 0x485a1e benchmark
  #8 0x488144 main
  #9 0x7f7db94cbd5d __libc_start_main
0x7f7db9086d28 is located 0 bytes to the right of 168-byte region [0x7f7db9086c80,0x7f7db9086d28)
allocated by thread T0 here:
  #0 0x5c3d92 malloc
  #1 0x4a0ce4 ft_mem_qalloc
  #2 0x48b28f ft_mem_alloc
  #3 0x4a38c2 ft_mem_qrealloc
  #4 0x48bb8d ft_mem_realloc
  #5 0x4ce13a Update_Max
  #6 0x4d0f02 TT_Load_Context
  #7 0x4d2a74 tt_size_run_fpgm
  #8 0x4d2220 tt_size_init_bytecode
  #9 0x4cfb9d tt_size_ready_bytecode
  #10 0x4c65ef tt_loader_init
  #11 0x4c56d0 TT_Load_Glyph
  #12 0x48934c FT_Load_Glyph
  #13 0x485be3 test_load
  #14 0x485a1e benchmark
  #15 0x488144 main
  #16 0x7f7db94cbd5d __libc_start_main
==17149== ABORTING
Stats: 0M malloced (0M for red zones) by 717 calls
Stats: 0M realloced by 5 calls
Stats: 0M freed by 12 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:685; 9:17; 10:6; 11:7; 12:1; 15:1;
  frees   by size class: 8:9; 9:1; 10:2;
  rfrees  by size class:
Stats: malloc large: 0 small slow: 7
Shadow byte and word:
  0x1fefb7210da5: fb
  0x1fefb7210da0: 00 00 00 00 00 fb fb fb
More shadow bytes:
  0x1fefb7210d80: fa fa fa fa fa fa fa fa
  0x1fefb7210d88: fa fa fa fa fa fa fa fa
  0x1fefb7210d90: 00 00 00 00 00 00 00 00
  0x1fefb7210d98: 00 00 00 00 00 00 00 00
=>0x1fefb7210da0: 00 00 00 00 00 fb fb fb
  0x1fefb7210da8: fb fb fb fb fb fb fb fb
  0x1fefb7210db0: fa fa fa fa fa fa fa fa
  0x1fefb7210db8: fa fa fa fa fa fa fa fa
  0x1fefb7210dc0: fa fa fa fa fa fa fa fa


Log from Valgrind:

==17268== Memcheck, a memory error detector
==17268== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==17268== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==17268== Command: ./ftbench /home/mjurczyk/tmp/freetype_run2/14963.21584.ttf.asan.51.14
==17268==
Load                      : ==17268== Invalid read of size 1
==17268==    at 0x423EDA: TT_RunIns (freetype2/src/truetype/ttinterp.c:7560)
==17268==    by 0x41CEF8: TT_Run_Context (freetype2/src/truetype/ttinterp.c:751)
==17268==    by 0x4175DD: TT_Hint_Glyph (freetype2/src/truetype/ttgload.c:799)
==17268==    by 0x417BB2: TT_Process_Simple_Glyph (freetype2/src/truetype/ttgload.c:920)
==17268==    by 0x418BF3: load_truetype_glyph (freetype2/src/truetype/ttgload.c:1408)
==17268==    by 0x419FEC: TT_Load_Glyph (freetype2/src/truetype/ttgload.c:2044)
==17268==    by 0x414DB1: tt_glyph_load (freetype2/src/truetype/ttdriver.c:334)
==17268==    by 0x4073F6: FT_Load_Glyph (freetype2/src/base/ftobjs.c:694)
==17268==    by 0x40177C: test_load (ft2demos-2.4.8/src/ftbench.c:221)
==17268==    by 0x4016B7: benchmark (ft2demos-2.4.8/src/ftbench.c:191)
==17268==    by 0x40274D: main (ft2demos-2.4.8/src/ftbench.c:794)
==17268==  Address 0x5657458 is 0 bytes after a block of size 168 alloc'd
==17268==    at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==17268==    by 0x49441F: ft_alloc (freetype2/src/base/ftsystem.c:74)
==17268==    by 0x413466: ft_mem_qalloc (freetype2/src/base/ftutil.c:76)
==17268==    by 0x4133EE: ft_mem_alloc (freetype2/src/base/ftutil.c:55)
==17268==    by 0x413626: ft_mem_qrealloc (freetype2/src/base/ftutil.c:145)
==17268==    by 0x4134EB: ft_mem_realloc (freetype2/src/base/ftutil.c:101)
==17268==    by 0x41C503: Update_Max (freetype2/src/truetype/ttinterp.c:528)
==17268==    by 0x41CA5F: TT_Load_Context (freetype2/src/truetype/ttinterp.c:622)
==17268==    by 0x41B013: tt_size_run_fpgm (freetype2/src/truetype/ttobjs.c:737)
==17268==    by 0x41B991: tt_size_init_bytecode (freetype2/src/truetype/ttobjs.c:992)
==17268==    by 0x41B9EE: tt_size_ready_bytecode (freetype2/src/truetype/ttobjs.c:1011)
==17268==    by 0x419A74: tt_loader_init (freetype2/src/truetype/ttgload.c:1858)
==17268==
63.750 us/op
Load_Advances (Normal)    : 59.310 us/op
Load_Advances (Fast)      : 2.046 us/op
Render                    : 27.327 us/op
Get_Glyph                 : 37.548 us/op
Get_CBox                  : 12.348 us/op
Get_Char_Index            : 3.007 us/op
Iterate CMap              : 760.633 us/op
New_Face                  : 1778.462 us/op
Embolden                  : 8.136 us/op
==17268==
==17268== HEAP SUMMARY:
==17268==     in use at exit: 0 bytes in 0 blocks
==17268==   total heap usage: 105,759 allocs, 105,759 frees, 26,842,732 bytes allocated
==17268==
==17268== All heap blocks were freed -- no leaks are possible
==17268==
==17268== For counts of detected and suppressed errors, rerun with: -v
==17268== ERROR SUMMARY: 370 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 #25192:  14963.21584.ttf.asan.51.14 added by j00ru (10KiB - 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 (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-01 wl StatusNone Fixed
        Assigned toNone wl
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.4.9
    2012-02-27 j00ru Attached File- Added 14963.21584.ttf.asan.51.14, #25192

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code