bugThe FreeType Project - Bugs: bug #35606, Out-of-bounds read in strncmp,...

 
 

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

bug #35606: Out-of-bounds read in strncmp, type1 parsing

Submitter:  Mateusz Jurczyk <j00ru>
Submitted:  Thu 23 Feb 2012 01:22:02 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:18:39 AM UTC, comment #1: 

Fixed in git, thanks.

Werner LEMBERG <wl>
Project Administrator
Thu 23 Feb 2012 01:22:02 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:

=================================================================
==2789== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f4c74ae1cfb at pc 0x5c5363 bp 0x7fff19b8bd90 sp 0x7fff19b8bd78
READ of size 1 at 0x7f4c74ae1cfb thread T0
  #0 0x5c5363 strncmp
  #1 0x4d793b parse_subrs
  #2 0x4e6de1 t1_load_keyword
  #3 0x4e4b0a parse_dict
  #4 0x4e2575 T1_Open_Face
  #5 0x4dbb2b T1_Face_Init
  #6 0x4913e0 open_face
  #7 0x4909a3 FT_Open_Face
  #8 0x48fd06 FT_New_Face
  #9 0x487557 get_face
  #10 0x487cb1 main
  #11 0x7f4c75736d5d __libc_start_main
0x7f4c74ae1cfb is located 0 bytes to the right of 1147-byte region [0x7f4c74ae1880,0x7f4c74ae1cfb)
allocated by thread T0 here:
  #0 0x5c3222 malloc
  #1 0x4a0434 ft_mem_qalloc
  #2 0x48b3cf ft_mem_alloc
  #3 0x4e540c T1_Get_Private_Dict
  #4 0x4e24ef T1_Open_Face
  #5 0x4dbb2b T1_Face_Init
  #6 0x4913e0 open_face
  #7 0x4909a3 FT_Open_Face
  #8 0x48fd06 FT_New_Face
  #9 0x487557 get_face
  #10 0x487cb1 main
  #11 0x7f4c75736d5d __libc_start_main
==2789== ABORTING
Stats: 0M malloced (0M for red zones) by 701 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 19 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:673; 9:17; 10:2; 11:6; 12:2; 15:1;
  frees   by size class: 8:17; 10:1; 11:1;
  rfrees  by size class:
Stats: malloc large: 0 small slow: 7
Shadow byte and word:
  0x1fe98e95c39f: 3
  0x1fe98e95c398: 00 00 00 00 00 00 00 03
More shadow bytes:
  0x1fe98e95c378: 00 00 00 00 00 00 00 00
  0x1fe98e95c380: 00 00 00 00 00 00 00 00
  0x1fe98e95c388: 00 00 00 00 00 00 00 00
  0x1fe98e95c390: 00 00 00 00 00 00 00 00
=>0x1fe98e95c398: 00 00 00 00 00 00 00 03
  0x1fe98e95c3a0: fa fa fa fa fa fa fa fa
  0x1fe98e95c3a8: fa fa fa fa fa fa fa fa
  0x1fe98e95c3b0: fa fa fa fa fa fa fa fa
  0x1fe98e95c3b8: fa fa fa fa fa fa fa fa

Log from Valgrind:

==2942== Memcheck, a memory error detector
==2942== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==2942== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==2942== Command: ./a.out tmp/freetype/a010013l.pfb.asan.73.218
==2942==
==2942== Invalid read of size 1
==2942==    at 0x41C4E7: parse_subrs (freetype2/freetype-2.4.8/src/type1/t1load.c:1410)
==2942==    by 0x41B973: parse_dict (freetype2/freetype-2.4.8/src/type1/t1load.c:930)
==2942==    by 0x41E040: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1load.c:2085)
==2942==    by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==2942==    by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==2942==    by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==2942==    by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==2942==    by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==2942==    by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==2942==  Address 0x53d572b is 0 bytes after a block of size 1,147 alloc'd
==2942==    at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==2942==    by 0x406CBF: ft_mem_qalloc (freetype2/freetype-2.4.8/src/base/ftutil.c:76)
==2942==    by 0x4082D2: ft_mem_alloc (freetype2/freetype-2.4.8/src/base/ftutil.c:55)
==2942==    by 0x41DF13: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:307)
==2942==    by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==2942==    by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==2942==    by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==2942==    by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==2942==    by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==2942==    by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==2942==
==2942== Invalid read of size 1
==2942==    at 0x41C493: parse_subrs (freetype2/freetype-2.4.8/src/type1/t1load.c:1391)
==2942==    by 0x41B973: parse_dict (freetype2/freetype-2.4.8/src/type1/t1load.c:930)
==2942==    by 0x41E040: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1load.c:2085)
==2942==    by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==2942==    by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==2942==    by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==2942==    by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==2942==    by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==2942==    by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==2942==  Address 0x53d572b is 0 bytes after a block of size 1,147 alloc'd
==2942==    at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==2942==    by 0x406CBF: ft_mem_qalloc (freetype2/freetype-2.4.8/src/base/ftutil.c:76)
==2942==    by 0x4082D2: ft_mem_alloc (freetype2/freetype-2.4.8/src/base/ftutil.c:55)
==2942==    by 0x41DF13: T1_Open_Face (freetype2/freetype-2.4.8/src/type1/t1parse.c:307)
==2942==    by 0x41E687: T1_Face_Init (freetype2/freetype-2.4.8/src/type1/t1objs.c:321)
==2942==    by 0x4089B7: open_face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1149)
==2942==    by 0x40B362: FT_Open_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:2076)
==2942==    by 0x40C58A: FT_New_Face (freetype2/freetype-2.4.8/src/base/ftobjs.c:1211)
==2942==    by 0x40235C: get_face (freetype2/ft2demos-2.4.8/src/ftbench.c:624)
==2942==    by 0x402660: main (freetype2/ft2demos-2.4.8/src/ftbench.c:752)
==2942==
couldn't load font resource
==2942==
==2942== HEAP SUMMARY:
==2942==     in use at exit: 0 bytes in 0 blocks
==2942==   total heap usage: 64 allocs, 64 frees, 33,497 bytes allocated
==2942==
==2942== All heap blocks were freed -- no leaks are possible
==2942==
==2942== For counts of detected and suppressed errors, rerun with: -v
==2942== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 4)

Mateusz Jurczyk <j00ru>
Project Member

 

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

Attached Files
file #25144:  a010013l.pfb.asan.73.218 added by j00ru (62KiB - application/octet-stream)
file #25145:  a010033l.pfb.asan.7f.218 added by j00ru (61KiB - 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 8 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 a010013l.pfb.asan.73.218, #25144
        Attached File- Added a010033l.pfb.asan.7f.218, #25145
        Carbon-Copy- Added j00ru

    Back to the top


    Powered by Savane 3.9