bugThe FreeType Project - Bugs: bug #46625, BDF only uses base 10 with ASCII...

 
 

bug #46625: BDF only uses base 10 with ASCII conversion functions.

Submitted by:  bungeman <bungeman>
Submitted on:  Mon 07 Dec 2015 05:08:09 PM UTC  
 
Severity: 3 - NormalItem Group: Wishlist
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.6.3

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 14 Dec 2015 08:22:24 AM UTC, comment #4:

Applied, thanks!

Note that it is better to not include ChangeLog changes in a patch; in case other people have added something meanwhile, the patch doesn't apply cleanly. Instead, put the ChangeLog entry in the preamble.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 10 Dec 2015 09:16:10 PM UTC, comment #3:

Previous patch used spaces instead of tabs in ChangeLog.

(file #35692)

bungeman <bungeman>
Thu 10 Dec 2015 08:27:55 PM UTC, comment #2:

A 'git format-patch' style patch is attached.

(file #35691)

bungeman <bungeman>
Thu 10 Dec 2015 06:55:09 AM UTC, comment #1:

I agree. Looking up the BDF specification, only decimal numbers are valid.

Currently, I don't have time to work on this, so if you want to prepare a patch, please go ahead :-)

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 07 Dec 2015 05:08:09 PM UTC, original submission:

While browsing code coverage after fuzzing, I noticed that in bdflib.c in _bdf_atoul, _bdf_atol, _bdf_atous, and _bdf_atos the 'case 8' and 'case 16' branches were never taken. Upon inspection of the call sites, it appears that these are always called with the literal '10' for the 'base' parameter.

As a result, odigits does not appear to ever be used. hdigits is used directly by the bitmap parsing code, which does not use these functions. These functions might be using hdigits, since they appear to do detection of '0x' or '0X' at the beginning of the string, but I see no indication that this was intended by the specification or that there are any fonts actually relying on this. The fuzzer is covering this case at least, but that's because it's creating garbage fonts.

As a result, I propose the removal of this effectively dead code. This means removing the 'unsigned int base' parameter from these functions, and adjust to the code as if the value passed was '10' (since it currently always is). This means 'odigits' can be removed completely. In addition, it should be determined if the checks for '0x' and '0X' in these functions actually make any sense and the code removed if not.

bungeman <bungeman>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files

 

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

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 14 Dec 2015 08:22:24 AM UTCwlStatusConfirmed=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.6.3
    Thu 10 Dec 2015 09:16:10 PM UTCbungemanAttached File-=>Added 0001-bdf-Remove-dead-code.patch, #35692
    Thu 10 Dec 2015 08:27:55 PM UTCbungemanAttached File-=>Added 0001-bdf-Remove-dead-code.patch, #35691
    Thu 10 Dec 2015 06:55:09 AM UTCwlStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1