Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants