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

Added range checks to cmap parsing #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added range checks to cmap parsing #30

wants to merge 1 commit into from

Conversation

flopp
Copy link

@flopp flopp commented Feb 19, 2016

Added range checks to func (f *Font) parseCmap() to fix the invalid array accesses caused by the ttf file ttf.crashers/9dcbc20080df0e49e3dd90c022eba03aa575c4b6 of #17.

N.B.: I have signed Google's CLA

@@ -201,13 +201,18 @@ func (f *Font) parseCmap() error {
return err
}
offset = int(u32(f.cmap, offset+4))
if offset <= 0 || offset > len(f.cmap) {
cmapLength := len(f.cmap)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this variable is really worth it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to check offset a couple of lines above this one?

@nigeltao
Copy link
Contributor

Sorry for the late reply. I'm not sure how this slipped off my radar.

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