Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

ebraminio
Copy link
Collaborator

No description provided.

/*
* 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
Copy link
Collaborator Author

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.

Copy link
Member

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.

@behdad
Copy link
Member

behdad commented Mar 12, 2018

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.)

@behdad behdad closed this Mar 12, 2018

for (unsigned int i = 0; i < 1 + c->num_glyphs; ++i)
if (!c->check_range (this, imageOffsetsZ[i]))
return_trace (false);
Copy link
Collaborator Author

@ebraminio ebraminio Mar 12, 2018

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?

Copy link
Member

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)? ;)

@ebraminio ebraminio deleted the sbix branch March 12, 2018 10:27
@ebraminio
Copy link
Collaborator Author

Thank you Behdad, I wanted to ask also what is the point of having accelerator_t and I am gradually understanding its role :)

@behdad
Copy link
Member

behdad commented Mar 12, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants