bugThe FreeType Project - Bugs: bug #35601, NULL Pointer Dereference in...

 
 

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

bug #35601: NULL Pointer Dereference in TT_RunIns / Move_Zp2_Point, ttf parsing

Submitted by:  Mateusz Jurczyk <j00ru>
Submitted on:  Thu 23 Feb 2012 12:41:09 PM UTC  
 
Severity:  3 - Normal Item Group:  Crash
Status:  Fixed Privacy:  Public
Assigned to:  Werner LEMBERG <wl> Open/Closed:  Closed
Planned Release:  2.4.9

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

Fixed in git, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 23 Feb 2012 12:41:09 PM UTC, original submission:  

Crash tested with ftbench, compiled under Ubuntu amd64 with AddressSanitizer (http://code.google.com/p/address-sanitizer/).

Crashlog:

#0  0x00000000004bca5d in Move_Zp2_Point ()
#1  0x00000000004b445d in Ins_SHZ ()
#2  0x00000000004acf83 in TT_RunIns ()
#3  0x00000000004d1080 in tt_size_run_prep ()
#4  0x00000000004cfaa9 in tt_size_ready_bytecode ()
#5  0x00000000004c604f in tt_loader_init ()
#6  0x00000000004c5131 in TT_Load_Glyph ()
#7  0x000000000048948f in FT_Load_Glyph ()
#8  0x0000000000485d33 in test_load (timer=0x7fffffffdf20, face=0x7ffff6777080, user_data=<optimized out>) at freetype2/ft2demos-2.4.8/src/ftbench.c:221
#9  0x0000000000485b6e in benchmark (face=0x7ffff6777080, test=<optimized out>, max_iter=0, max_time=2) at freetype2/ft2demos-2.4.8/src/ftbench.c:191
#10 0x0000000000488294 in main (argc=<optimized out>, argv=<optimized out>) at freetype2/ft2demos-2.4.8/src/ftbench.c:794

=> 0x4bca5d <Move_Zp2_Point+125>: add    QWORD PTR [rbx],rdx
   0x4bca60 <Move_Zp2_Point+128>: test   r8b,r8b
   0x4bca63 <Move_Zp2_Point+131>: je     0x4bcaa4 <Move_Zp2_Point+196>
   0x4bca65 <Move_Zp2_Point+133>: lea    rdx,[rdi+0xf0]
   0x4bca6c <Move_Zp2_Point+140>: mov    rax,rdx

rax            0x100000000000 17592186044416
rbx            0x0 0
rcx            0x0 0
rdx            0x0 0
rsi            0x0 0
rdi            0x7ffff6776080 140737328406656
rbp            0x7fffffffd630 0x7fffffffd630
rsp            0x7fffffffd620 0x7fffffffd620
r8             0x0 0
r9             0x7ffff6776160 140737328406880
r10            0x0 0
r11            0x100000000000 17592186044416
r12            0x0 0
r13            0x0 0
r14            0x1ffffeceec2c 35184352095276
r15            0x7ffff6776080 140737328406656
rip            0x4bca5d 0x4bca5d <Move_Zp2_Point+125>
eflags         0x10246 [ PF ZF IF RF ]
cs             0x33 51
ss             0x2b 43
ds             0x0 0
es             0x0 0
fs             0x0 0
gs             0x0 0

Log from Valgrind:

==29738== Memcheck, a memory error detector
==29738== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==29738== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==29738== Command: ./a.out tmp/freetype/12266.26903.ttf.3dd.11
==29738==
Load                      : ==29738== Invalid read of size 8
==29738==    at 0x4157AD: TT_RunIns (freetype2/freetype-2.4.8/src/truetype/ttinterp.c:5690)
==29738==    by 0x40F0C2: tt_size_run_prep (freetype2/freetype-2.4.8/src/truetype/ttobjs.c:848)
==29738==    by 0x417DB6: tt_loader_init (freetype2/freetype-2.4.8/src/truetype/ttobjs.c:1036)
==29738==    by 0x41847C: TT_Load_Glyph (freetype2/freetype-2.4.8/src/truetype/ttgload.c:2035)
==29738==    by 0x409A59: FT_Load_Glyph (freetype2/freetype-2.4.8/src/base/ftobjs.c:690)
==29738==    by 0x4017C4: test_load (freetype2/ft2demos-2.4.8/src/ftbench.c:221)
==29738==    by 0x4016FC: benchmark (freetype2/ft2demos-2.4.8/src/ftbench.c:191)
==29738==    by 0x4027BC: main (freetype2/ft2demos-2.4.8/src/ftbench.c:794)
==29738==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==29738==
==29738==
==29738== Process terminating with default action of signal 11 (SIGSEGV)
==29738==  Access not within mapped region at address 0x0
==29738==    at 0x4157AD: TT_RunIns (freetype2/freetype-2.4.8/src/truetype/ttinterp.c:5690)
==29738==    by 0x40F0C2: tt_size_run_prep (freetype2/freetype-2.4.8/src/truetype/ttobjs.c:848)
==29738==    by 0x417DB6: tt_loader_init (freetype2/freetype-2.4.8/src/truetype/ttobjs.c:1036)
==29738==    by 0x41847C: TT_Load_Glyph (freetype2/freetype-2.4.8/src/truetype/ttgload.c:2035)
==29738==    by 0x409A59: FT_Load_Glyph (freetype2/freetype-2.4.8/src/base/ftobjs.c:690)
==29738==    by 0x4017C4: test_load (freetype2/ft2demos-2.4.8/src/ftbench.c:221)
==29738==    by 0x4016FC: benchmark (freetype2/ft2demos-2.4.8/src/ftbench.c:191)
==29738==    by 0x4027BC: main (freetype2/ft2demos-2.4.8/src/ftbench.c:794)
==29738==  If you believe this happened as a result of a stack
==29738==  overflow in your program's main thread (unlikely but
==29738==  possible), you can try to increase the size of the
==29738==  main thread stack using the --main-stacksize= flag.
==29738==  The main thread stack size used in this run was 8388608.
==29738==
==29738== HEAP SUMMARY:
==29738==     in use at exit: 37,397 bytes in 69 blocks
==29738==   total heap usage: 70 allocs, 1 frees, 37,405 bytes allocated
==29738==
==29738== LEAK SUMMARY:
==29738==    definitely lost: 0 bytes in 0 blocks
==29738==    indirectly lost: 0 bytes in 0 blocks
==29738==      possibly lost: 0 bytes in 0 blocks
==29738==    still reachable: 37,397 bytes in 69 blocks
==29738==         suppressed: 0 bytes in 0 blocks
==29738== Rerun with --leak-check=full to see details of leaked memory
==29738==
==29738== For counts of detected and suppressed errors, rerun with: -v
==29738== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

Mateusz Jurczyk <j00ru>
Project Member

 

Attached Files
file #25143:  Verdana.dfont.49e.214 added by j00ru (102KiB - application/octet-stream - Yet another related sample.)
file #25140:  Garuda.ttf.3dd.148 added by j00ru (73KiB - application/octet-stream - Another file reproducing the issue with a slightly different callstack.)
file #25134:  12266.26903.ttf.3dd.11 added by j00ru (31KiB - 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
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-01 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 Verdana.dfont.49e.214, #25143
    2012-02-23 j00ru Attached File- => Added Garuda.ttf.3dd.148, #25140
    2012-02-23 j00ru Attached File- => Added 12266.26903.ttf.3dd.11, #25134
        Carbon-Copy- => Added j00ru

    Back to the top


    Powered by Savane 3.6