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

Bug in OTProcessor.js - method getClassID #65

Closed
liborm85 opened this issue Dec 31, 2016 · 2 comments
Closed

Bug in OTProcessor.js - method getClassID #65

liborm85 opened this issue Dec 31, 2016 · 2 comments

Comments

@liborm85
Copy link
Contributor

Commit 554a005 introduced a bug that sometimes causes crash - it may be return undefined.

For example:
This lines: https://github.com/devongovett/fontkit/blob/08171fe567b4922325bcd5a268e238501624b890/src/opentype/OTProcessor.js#L237-L240
When glyph is 3 and classDef.startGlyph is 4. Variable i will be -1.
Condition will be valid and will be returned index -1 from array which will undefined. And this causes an error in the other methods.
Probably there should be something like: if (i > -1 && i < classDef.classValueArray.length) {

I do not know exactly how it should work, but condition for negative number i do not return true.

This bug causes crash in https://github.com/bpampuch/pdfmake when I use any font.

@devongovett
Copy link
Member

I applied your fix in 26f99b8, and released in v1.5.4. Would like to add a test case for that. Do you have a font that causes this error?

@liborm85
Copy link
Contributor Author

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

No branches or pull requests

2 participants