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

 
 

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

Submitted by:  Kostya Serebryany <kcc>
Submitted on:  Fri 11 Sep 2015 09:43:55 PM UTC  
 
Severity: 3 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.6.1

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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

Fixed in git, thanks!

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
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>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 13 Sep 2015 07:22:39 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.6.1

    Back to the top


    Powered by Savane 3.1-cleanup1