bugThe FreeType Project - Bugs: bug #45938, src/winfonts/winfnt.c:382:61:...

 
 

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

bug #45938: src/winfonts/winfnt.c:382:61: runtime error: shift exponent 2816 is too large for 64-bit type 'FT_ULong'

Submitter:  Kostya Serebryany <kcc>
Submitted:  Fri 11 Sep 2015 09:43:55 PM UTC
   
 
Severity:  3 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.6.1

Sun 13 Sep 2015 07:22:39 AM UTC, comment #1: 

Fixed in git, thanks!

Werner LEMBERG <wl>
Group administrator
Fri 11 Sep 2015 09:43:55 PM UTC, original submission:  

found on fresh git with libFuzzer+UBSan

Build with ubsan (clang -fsanitize=shift).
Feed the data below (base64-encoded) into FT_New_Memory_Face

src/winfonts/winfnt.c:381:61: runtime error: shift exponent 2816 is too large for 64-bit type 'FT_ULong' (aka 'unsigned long')

Indeed, this code is:
        size_shift = FT_GET_USHORT_LE();
...
        face->font->offset   = (FT_ULong)FT_GET_USHORT_LE() << size_shift;

i.e. the bytes taken directly from the user input are used for the shift exponent.
in C/C++, shifting a 64-bit value by more than 63 is undefined behavior.


TVopASgnKiAnbU5FN2IoASgKJyogVydtJyogAbEoujcoISoKYgH/CAEovwonADsAAgEBCAr/CAEo
vwEnCgAAAAABAACAAAsABAMAME9TLzI99X9bAAABOAAAAE5jbWFwi9+wwAAAA4gAAAKWZ2FzcDr/
/wADAAA65AAAAAIAACgKJwEAAQAAKgQLAIAAAwAwT1MvMj31f1sAAAE4AAAATmNtYXCL37DAAAAD
iAAAApZnYXNw/x0AAwAAAADkADoIgAIAAAEoKQQoJyogJ/C6KTdiKS8qIQUsCiEFKBYoCicqIDdt
AAEoAABnbHkmWVZymAAAKAonKiAnKtcpN2IoJ5coCicqByQAADBmaGVhZM1pPh4AAAC8KAoqICdt
JwBGADZoaGVhDe4GNgAAAPQAAAAkaG10eF+4DcAAAAGIAAAB/iBXbbo3bG9jYfY96kAAAAYgAAAB
Am1heHAA6gE=

Kostya Serebryany <kcc>
Group Member

 

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

No files currently attached

 

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 kcc (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-13 wl StatusNone Fixed
        Assigned toNone wl
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.6.1

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code