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

 
 

bug #35643: Out-of-bounds read in _bdf_parse_start

Submitted by:  Mateusz Jurczyk <j00ru>
Submitted on:  Mon 27 Feb 2012 03:56:36 PM UTC  
 
Severity: 3 - NormalItem Group: Crash
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.4.9

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Thu 01 Mar 2012 08:31:49 PM UTC, comment #1:

Fixed in git, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 27 Feb 2012 03:56:36 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 from ASAN:

=================================================================
==15621== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f4f4098b1a0 at pc 0x56cd2c bp 0x7fffd1c08030 sp 0x7fffd1c08028
READ of size 8 at 0x7f4f4098b1a0 thread T0
#0 0x56cd2c _bdf_parse_start
#1 0x56b116 _bdf_readstream
#2 0x5692b9 bdf_load_font
#3 0x56634d BDF_Face_Init
#4 0x4912d0 open_face
#5 0x490893 FT_Open_Face
#6 0x48fbf6 FT_New_Face
#7 0x487407 get_face
#8 0x487b61 main
#9 0x7f4f409e2d5d __libc_start_main
0x7f4f4098b1a0 is located 0 bytes to the right of 32-byte region [0x7f4f4098b180,0x7f4f4098b1a0)
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 0x573925 _bdf_list_ensure
#6 0x56de09 _bdf_list_split
#7 0x56c159 _bdf_parse_start
#8 0x56b116 _bdf_readstream
#9 0x5692b9 bdf_load_font
#10 0x56634d BDF_Face_Init
#11 0x4912d0 open_face
#12 0x490893 FT_Open_Face
#13 0x48fbf6 FT_New_Face
#14 0x487407 get_face
#15 0x487b61 main
#16 0x7f4f409e2d5d __libc_start_main
==15621== ABORTING
Stats: 0M malloced (0M for red zones) by 793 calls
Stats: 0M realloced by 2 calls
Stats: 0M freed by 30 calls
Stats: 0M really freed by 0 calls
Stats: 36M (9221 full pages) mmaped in 9 calls
mmaps by size class: 8:16383; 9:8191; 10:4095; 11:2047; 12:1024; 13:512; 15:128; 19:8; 20:4;
mallocs by size class: 8:758; 9:16; 10:6; 11:6; 12:3; 13:1; 15:1; 19:1; 20:1;
frees by size class: 8:17; 9:3; 10:6; 11:2; 12:1; 13:1;
rfrees by size class:
Stats: malloc large: 2 small slow: 8
Shadow byte and word:
0x1fe9e8131634: fb
0x1fe9e8131630: 00 00 00 00 fb fb fb fb
More shadow bytes:
0x1fe9e8131610: 00 00 00 fb fb fb fb fb
0x1fe9e8131618: fb fb fb fb fb fb fb fb
0x1fe9e8131620: fa fa fa fa fa fa fa fa
0x1fe9e8131628: fa fa fa fa fa fa fa fa
=>0x1fe9e8131630: 00 00 00 00 fb fb fb fb
0x1fe9e8131638: fb fb fb fb fb fb fb fb
0x1fe9e8131640: fa fa fa fa fa fa fa fa
0x1fe9e8131648: fa fa fa fa fa fa fa fa
0x1fe9e8131650: 00 00 00 00 00 00 00 02

Log from Valgrind:

==12261== Memcheck, a memory error detector
==12261== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==12261== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==12261== Command: ./ftbench tmp/etl24-unicode.bdf.asan.7c.490
==12261==
==12261== Invalid read of size 8
==12261== at 0x4544B1: _bdf_parse_start (freetype2/src/bdf/bdflib.c:2187)
==12261== by 0x4511FA: _bdf_readstream (freetype2/src/bdf/bdflib.c:765)
==12261== by 0x454D69: bdf_load_font (freetype2/src/bdf/bdflib.c:2367)
==12261== by 0x4560D8: BDF_Face_Init (freetype2/src/bdf/bdfdrivr.c:367)
==12261== by 0x407F6F: open_face (freetype2/src/base/ftobjs.c:1153)
==12261== by 0x4097F3: FT_Open_Face (freetype2/src/base/ftobjs.c:2080)
==12261== by 0x40808C: FT_New_Face (freetype2/src/base/ftobjs.c:1215)
==12261== by 0x402302: get_face (ft2demos-2.4.8/src/ftbench.c:624)
==12261== by 0x4025F4: main (ft2demos-2.4.8/src/ftbench.c:752)
==12261== Address 0x5727df0 is 0 bytes after a block of size 32 alloc'd
==12261== at 0x4C2A4D6: malloc (coregrind/m_replacemalloc/vg_replace_malloc.c:263)
==12261== by 0x49441F: ft_alloc (freetype2/src/base/ftsystem.c:74)
==12261== by 0x413466: ft_mem_qalloc (freetype2/src/base/ftutil.c:76)
==12261== by 0x4133EE: ft_mem_alloc (freetype2/src/base/ftutil.c:55)
==12261== by 0x413626: ft_mem_qrealloc (freetype2/src/base/ftutil.c:145)
==12261== by 0x4134EB: ft_mem_realloc (freetype2/src/base/ftutil.c:101)
==12261== by 0x45091C: _bdf_list_ensure (freetype2/src/bdf/bdflib.c:478)
==12261== by 0x450CE2: _bdf_list_split (freetype2/src/bdf/bdflib.c:605)
==12261== by 0x454589: _bdf_parse_start (freetype2/src/bdf/bdflib.c:2202)
==12261== by 0x4511FA: _bdf_readstream (freetype2/src/bdf/bdflib.c:765)
==12261== by 0x454D69: bdf_load_font (freetype2/src/bdf/bdflib.c:2367)
==12261== by 0x4560D8: BDF_Face_Init (freetype2/src/bdf/bdfdrivr.c:367)
==12261==
_bdf_parse_start: [line 93] Invalid keyword.
couldn't load font resource
==12261==
==12261== HEAP SUMMARY:
==12261== in use at exit: 0 bytes in 0 blocks
==12261== total heap usage: 165 allocs, 165 frees, 882,984 bytes allocated
==12261==
==12261== All heap blocks were freed -- no leaks are possible
==12261==
==12261== For counts of detected and suppressed errors, rerun with: -v
==12261== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

Mateusz Jurczyk <j00ru>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #25194:  etl24-unicode.bdf.asan.7c.490 added by j00ru (400kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 01 Mar 2012 08:31:49 PM UTCwlStatusNone=>Fixed
      PrivacyPrivate=>Public
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.4.9
    Mon 27 Feb 2012 03:56:36 PM UTCj00ruAttached File-=>Added etl24-unicode.bdf.asan.7c.490, #25194

    Back to the top


    Powered by Savane 3.1-cleanup