-
Notifications
You must be signed in to change notification settings - Fork 610
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
[ot-color/sbix] imageOffsets range check #879
Conversation
/* | ||
* sbix -- Standard Bitmap Graphics Table | ||
* https://docs.microsoft.com/en-us/typography/opentype/spec/sbix | ||
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6sbix.html |
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.
There are more things on Apple's specification but currently no fonts on macOS to test them.
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.
We'll just support the OpenType version. The rest is deprecated and there are no fonts out there.
We don't want to do this check. One of the design criteria is that we don't do O(num-glyphs) or any other heavy-weight checks at sanitize() time if they can be easily done at run time. Ie. we need a sbix_accelerator_t that does the check. That's actually why the glyf table sanitize is empty. You asked about it the other day... (If we wanted though, we should have checked that the offsets are non-decreasing.) |
|
||
for (unsigned int i = 0; i < 1 + c->num_glyphs; ++i) | ||
if (!c->check_range (this, imageOffsetsZ[i])) | ||
return_trace (false); |
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.
How about first finding the maximum imageOffsetsZ value then checking if that is in range?
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.
How is that not O(num-glyphs)? ;)
Thank you Behdad, I wanted to ask also what is the point of having accelerator_t and I am gradually understanding its role :) |
The accelerator pattern is used when we need to carry extra information for efficient use of the table. Ie. when just having a pointer to the table itself is not enough. |
No description provided.