-
Notifications
You must be signed in to change notification settings - Fork 475
[CFF2] Unhandled exception #1474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is something new: I get the same stack dump with that head of the fonttools master branch, which has the aforementioned fixes. Will look at this. |
I see that gid 3 is a bad charstring: it ends with a byte that it supposed to be the first byte of a two byte charstring. psCharstrings.py tries to get the second byte, and there isn't one -> IndexError. This immediately follows a hintmask, which is odd - not a lot of reason to change hintmasks at the end of a charstring. I also see that this font was made in July 2018, when any hinting was in very early days. Even though this is a bad charstring, I vote for protecting psCharstrings against this. The function getToken() already returns None for a value if there aren't enough bytes to to get the first byte, but is missing the check for the case where it needs to access a second byte. |
Now that I have fixed the font ( which is a test font in the afdko), I argue against protecting psCharstrings against this error. The test font had some garbage data added to the end of the charstring because of bugs in July 2018 in merging charstring hint data. However, in general, you get this problem only when you have a malformed charstring, with some data truncated from the end of the charstring, and it would be bad to silently truncate the charstring at the start of the bad data. I think that "ERROR: Error in charstring X' is more appropriate. This should also be a very rare error. |
Bad charstring. Closing. |
cff2_vf.otf.zip
The text was updated successfully, but these errors were encountered: