jasonvitagen / sfntly

Automatically exported from code.google.com/p/sfntly
0 stars 0 forks source link

Font with Bad CMap Format 4 Causes Exception #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using SfntTool to subset font bl-norm.ttf
2. Get exception

Hi,
I was testing out using the sfnttool to subset a font, and I came across this 
error:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index attempted
to be read from is out of bounds: 100f5
        at com.google.typography.font.sfntly.data.ReadableFontData.readUByte(Unknown Source)
        at com.google.typography.font.sfntly.data.ReadableFontData.readUShort(Unknown Source)
        at com.google.typography.font.sfntly.table.core.CMapFormat4.retrieveGlyphId(Unknown Source)
        at com.google.typography.font.sfntly.table.core.CMapFormat4.glyphId(Unknown Source)
        at com.google.typography.font.tools.subsetter.RenumberingCMapTableSubsetter.computeMapping(Unknown Source)
        at com.google.typography.font.tools.subsetter.RenumberingCMapTableSubsetter.subset(Unknown Source)
        at com.google.typography.font.tools.subsetter.Subsetter.subset(Unknown Source)
        at com.google.typography.font.tools.sfnttool.SfntTool.subsetFontFile(Unknown Source)
        at com.google.typography.font.tools.sfnttool.SfntTool.main(Unknown Source)

I was wondering what could be causing this error? I have attached the font 
involved.

Original issue reported on code.google.com by stua...@google.com on 27 Aug 2012 at 5:43

Attachments:

GoogleCodeExporter commented 9 years ago
Investigation from Raph uncovered:

Yes, the font is invalid:

Segment=28 unicode-start=ffff end=ffff range-offset=65535 delta=1 End

This is a "range-offset" value that points well beyond the end of the cmap. A 
lot of consumers of this font might ignore such a flaw. OpenType Sanitizer also 
complains (although strangely this seems to be a warning rather than an error):

Original comment by stua...@google.com on 27 Aug 2012 at 5:43