[ 
https://issues.apache.org/jira/browse/FOP-2977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258427#comment-17258427
 ] 

Kelly H Wilkerson edited comment on FOP-2977 at 1/4/21, 6:58 PM:
-----------------------------------------------------------------

Looks like there's more I need to add to this patch, since with this patch 
there are more exceptions if  the font has GPOS adjustments. But I haven't 
recreated this crash yet to fix it.

 

{{java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphPositioningTable$MarkToLigatureSubtableFormat1.getLigatureAnchor([GlyphPositioningTable.java:974|http://glyphpositioningtable.java:974/])}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphPositioningTable$MarkToLigatureSubtable.position([GlyphPositioningTable.java:886|http://glyphpositioningtable.java:886/])}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphPositioningState.apply([GlyphPositioningState.java:170|http://glyphpositioningstate.java:170/])}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable.position([GlyphPositioningSubtable.java:94|http://glyphpositioningsubtable.java:94/])}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable.position([GlyphPositioningSubtable.java:126|http://glyphpositioningsubtable.java:126/])}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphTable$LookupTable.position([GlyphTable.java:675|http://glyphtable.java:675/])}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphTable$UseSpec.position([GlyphTable.java:816|http://glyphtable.java:816/])}}
{{at 
org.apache.fop.complexscripts.scripts.ScriptProcessor.position([ScriptProcessor.java:191|http://scriptprocessor.java:191/])}}
{{at 
org.apache.fop.complexscripts.scripts.ScriptProcessor.position([ScriptProcessor.java:171|http://scriptprocessor.java:171/])}}
{{at 
org.apache.fop.complexscripts.fonts.GlyphPositioningTable.position([GlyphPositioningTable.java:239|http://glyphpositioningtable.java:239/])}}
{{at 
org.apache.fop.fonts.MultiByteFont.performPositioning([MultiByteFont.java:611|http://multibytefont.java:611/])}}
{{at 
org.apache.fop.fonts.LazyFont.performPositioning([LazyFont.java:471|http://lazyfont.java:471/])}}
{{at 
org.apache.fop.fonts.Font.performPositioning([Font.java:502|http://font.java:502/])}}
{{at 
org.apache.fop.fonts.Font.performPositioning([Font.java:510|http://font.java:510/])}}
{{at 
org.apache.fop.fonts.GlyphMapping.processWordMapping([GlyphMapping.java:147|http://glyphmapping.java:147/])}}
{{at 
org.apache.fop.fonts.GlyphMapping.doGlyphMapping([GlyphMapping.java:92|http://glyphmapping.java:92/])}}


was (Author: kwilkerson):
Looks like there's more I need to add to this patch, since with this patch 
there are more exceptions if  the font has GPOS adjustments. But I haven't 
recreated this crash yet to fix it.

 

java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
 at 
org.apache.fop.complexscripts.fonts.GlyphPositioningTable$MarkToLigatureSubtableFormat1.getLigatureAnchor(GlyphPositioningTable.java:974)
 at 
org.apache.fop.complexscripts.fonts.GlyphPositioningTable$MarkToLigatureSubtable.position(GlyphPositioningTable.java:886)
 at 
org.apache.fop.complexscripts.fonts.GlyphPositioningState.apply(GlyphPositioningState.java:170)
 at 
org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable.position(GlyphPositioningSubtable.java:94)
 at 
org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable.position(GlyphPositioningSubtable.java:126)
 at 
org.apache.fop.complexscripts.fonts.GlyphTable$LookupTable.position(GlyphTable.java:675)
 at 
org.apache.fop.complexscripts.fonts.GlyphTable$UseSpec.position(GlyphTable.java:816)
 at 
org.apache.fop.complexscripts.scripts.ScriptProcessor.position(ScriptProcessor.java:191)
 at 
org.apache.fop.complexscripts.scripts.ScriptProcessor.position(ScriptProcessor.java:171)
 at 
org.apache.fop.complexscripts.fonts.GlyphPositioningTable.position(GlyphPositioningTable.java:239)
 at 
org.apache.fop.fonts.MultiByteFont.performPositioning(MultiByteFont.java:611)
 at org.apache.fop.fonts.LazyFont.performPositioning(LazyFont.java:471)
 at org.apache.fop.fonts.Font.performPositioning(Font.java:502)
 at org.apache.fop.fonts.Font.performPositioning(Font.java:510)
 at org.apache.fop.fonts.GlyphMapping.processWordMapping(GlyphMapping.java:147)
 at org.apache.fop.fonts.GlyphMapping.doGlyphMapping(GlyphMapping.java:92)

> [PATCH] Array index out of bounds with glyph position adjustments and 
> surrogate pairs
> -------------------------------------------------------------------------------------
>
>                 Key: FOP-2977
>                 URL: https://issues.apache.org/jira/browse/FOP-2977
>             Project: FOP
>          Issue Type: Bug
>          Components: renderer/pdf
>    Affects Versions: trunk
>         Environment: Windows 10
>            Reporter: Kelly H Wilkerson
>            Priority: Minor
>         Attachments: arrayindex.patch, drawTextWithDX.patch, input.fo
>
>
> Out of bounds happens in org.apache.fop.fonts.GlyphMapping.processWordMapping 
> when:
> # There are glyph position adjustments for the font being used
> # There are surrogate pairs in the text that has adjustments
> The font I've used to reproduce the issue so far is Segoe UI Emoji, which 
> should be installed on Windows 10 by default.
> input.fo attached to cause the crash.
> I believe I've fixed the crash in the attached patch.
> There's a separate issue demonstrated in the input.fo that the glyphs don't 
> render in some cases, even though the font is the same throughout everything. 
> But I'd like to make sure my fix for the crash is correct before I dig into 
> the rendering issue.
> {code:java}
> org.apache.fop.apps.FOPException: java.lang.ArrayIndexOutOfBoundsException: 3
> javax.xml.transform.TransformerException: 
> java.lang.ArrayIndexOutOfBoundsException: 3
>       at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:296)
>       at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:116)
>       at org.apache.fop.cli.Main.startFOP(Main.java:183)
>       at org.apache.fop.cli.Main.main(Main.java:214)
> Caused by: javax.xml.transform.TransformerException: 
> java.lang.ArrayIndexOutOfBoundsException: 3
>       at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)
>       at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:343)
>       at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:293)
>       ... 3 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
>       at 
> org.apache.fop.fonts.GlyphMapping.processWordMapping(GlyphMapping.java:177)
>       at 
> org.apache.fop.fonts.GlyphMapping.doGlyphMapping(GlyphMapping.java:92)
>       at 
> org.apache.fop.layoutmgr.inline.TextLayoutManager.processWord(TextLayoutManager.java:963)
>       at 
> org.apache.fop.layoutmgr.inline.TextLayoutManager.getNextKnuthElements(TextLayoutManager.java:881)
>       at 
> org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements(LineLayoutManager.java:698)
>       at 
> org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:627)
>       at 
> org.apache.fop.layoutmgr.BlockLayoutManager.getNextChildElements(BlockLayoutManager.java:141)
>       at 
> org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:292)
>       at 
> org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:113)
>       at 
> org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:105)
>       at 
> org.apache.fop.layoutmgr.BlockLayoutManager.getNextChildElements(BlockLayoutManager.java:141)
>       at 
> org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:292)
>       at 
> org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:113)
>       at 
> org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:105)
>       at 
> org.apache.fop.layoutmgr.FlowLayoutManager.getNextChildElements(FlowLayoutManager.java:223)
>       at 
> org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:148)
>       at 
> org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:116)
>       at 
> org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:69)
>       at 
> org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:252)
>       at 
> org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:675)
>       at 
> org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:179)
>       at 
> org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:159)
>       at 
> org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:385)
>       at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:113)
>       at 
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:143)
>       at 
> org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
>       at 
> org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:139)
>       at 
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:362)
>       at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
>       at 
> com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:265)
>       at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown 
> Source)
>       at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
>       at 
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
>       at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>  Source)
>       at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
> Source)
>       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>       at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
> Source)
>       at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:659)
>       at 
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:728)
>       ... 5 more
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to