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

x/image/font/sfnt: fails to parse legacy TrueType font #28339

Closed
dennwc opened this issue Oct 23, 2018 · 3 comments
Closed

x/image/font/sfnt: fails to parse legacy TrueType font #28339

dennwc opened this issue Oct 23, 2018 · 3 comments
Milestone

Comments

@dennwc
Copy link
Contributor

@dennwc dennwc commented Oct 23, 2018

What did you do?

Parse the FreeSans.ttf file:

data, _ := ioutil.ReadFile("FreeSans.ttf")
_, err := sfnt.Parse(data)
if err != nil {
	panic(err)
}

What did you expect to see?

no error

What did you see instead?

panic: sfnt: invalid OS/2 table

Details

The code check the size of the OS/2 header without asserting a version. The file that triggers an issue has a version = 1, which has a header size of 86 bytes instead of minimal 96 bytes required by the library.

See https://docs.microsoft.com/da-dk/typography/opentype/spec/os2 for more details.

@gopherbot gopherbot added this to the Unreleased milestone Oct 23, 2018
@dgryski
Copy link
Contributor

@dgryski dgryski commented Oct 24, 2018

/cc @nigeltao

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 24, 2018

Change https://golang.org/cl/144079 mentions this issue: font/sfnt: support parsing legacy fonts with OS2 table version <= 1

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 30, 2018

Change https://golang.org/cl/146081 mentions this issue: font/sfnt: add parsing tests

@golang golang locked and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.