-
Notifications
You must be signed in to change notification settings - Fork 24
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
Avoid various overflows in CFF #1196
Conversation
Add targeted `wrapping_add` and `wrapping_sub` calls to avoid panics on arithmetic overflows for the specific case in #1193
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes, comments below:
@@ -224,6 +224,12 @@ impl Stack { | |||
} else { | |||
Fixed::from_i32(*value) | |||
}; | |||
// See <https://github.com/googlefonts/fontations/issues/1193> | |||
// The "DIN Alternate" font contains incorrect blue values | |||
// that cause an overflow in this computation. FreeType does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Would you have a link to the equivalent logic in FreeType similar to this delta accumulation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The equivalent logic is here: https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/cff/cffparse.c#L1431 along with the "fixed" case below. I'll add this link to the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes.
Confirmed locally to enable the display of the DIN font using Fontations in Chromium. |
Add targeted `wrapping_add` and `wrapping_sub` calls to avoid panics on arithmetic overflows for the specific case in #1193
Add targeted
wrapping_add
andwrapping_sub
calls to avoid panics on arithmetic overflows for the specific case in #1193