bugThe FreeType Project - Bugs: bug #46250, Crash in cid_load_glyph with...


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

bug #46250: Crash in cid_load_glyph with malformed cid font.

Submitter:  bungeman <bungeman>
Submitted:  Mon 19 Oct 2015 05:40:49 PM UTC
Severity:  3 - Normal Item Group:  Crash
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.6.2

Tue 20 Oct 2015 10:25:09 AM UTC, comment #2: 

I've fixed it differently.  Thanks for the report!

Werner LEMBERG <wl>
Group administrator
Mon 19 Oct 2015 08:25:32 PM UTC, comment #1: 

I've locally patched cid_load_glyph like

     /* Now set up the subrs array and parse the charstrings. */
+      if (!face->subrs)
+      {
+        FT_TRACE0(( "cid_load_glyph: invalid subrs\n" ));
+        error = FT_THROW( Invalid_Offset );
+        goto Exit;
+      }
       CID_FaceDict  dict;

and this does alleviate the issue, but this seems an odd place to check for this (and the error isn't entirely correct either). It seems that cid_load_glyph should be able to assume that is called '((CID_Face)decoder->builder.face)->subrs' should be valid and that the font would have failed earlier, but I'm not entirely sure about that.

bungeman <bungeman>
Mon 19 Oct 2015 05:40:49 PM UTC, original submission:  

Found with libFuzzer+AddressSanitizer at FreeType 5179c89f61aa6b6de00aa01c2e8b7fb6cf3021d0, reproduction attached.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000831e17 in cid_load_glyph

cid_load_glyph  freetype2/src/cid/cidgload.c:145:39
cid_slot_load_glyph  freetype2/src/cid/cidgload.c:329:13
FT_Load_Glyph  freetype2/src/base/ftobjs.c:742:15

On the line

decoder->num_subrs = cid_subrs->num_subrs;

'cid_subrs' is invalid because on a previous line

CID_Subrs     cid_subrs = face->subrs + fd_select;

'face' is ok but 'face->subrs' is NULL, so this is essentially trying to dereference 'fd_select'.

bungeman <bungeman>


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

Attached Files


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 bungeman (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
    2015-10-20 wl StatusNone Fixed
        Assigned toNone wl
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.6.2
    2015-10-19 bungeman Attached File- Added crash-f00a4b3f000752568f70bfdf20261ae213a27ffc, #35229

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code