os/2 table doesn't check for version
Pomax opened this issue · 1 comments
Pomax commented
https://github.com/bramstein/opentype/blob/master/src/tables/os2.js#L58 may cause interesting problems, as versions for OS/2 tables version 0, 1, and 2 contain fewer records.
- version 0 table ends after
usWinDescent
- version 1 table ends after
ulCodePageRange2
- version 2 table ends after
usMaxContext
It might also be worth adding a check based on the SFNT table directory length; if you're reading more data than the directory "length" value says there should be, something potentially bad is going on.
bramstein commented
Thanks for letting me know! I've corrected the OS/2 table parser and released a new version. I've been meaning to write some test suite for this library that simulates input for all versions and checks it is parsed correctly. I'm extremely busy at the moment but I hope to get to it soon.