You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Kelly H Wilkerson (Jira)" <ji...@apache.org> on 2021/03/26 19:18:00 UTC

[jira] [Comment Edited] (FOP-3004) Invalid TTC file causes NullPointerException

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

Kelly H Wilkerson edited comment on FOP-3004 at 3/26/21, 7:17 PM:
------------------------------------------------------------------

Thank you for the followup, and sorry for the delay! This was on a customer's machine, so I can't guarantee that I'm providing the same files. However, I dug around in one of my Windows 10 PCs and found several copies of ecmdl2.ttf (EC MDL2 Assets).

I have a correct (previewable in Windows) copy in two places:
{code:java}
C:\Windows\SystemResources\TextInput\Assets\Fonts{code}
{code:java}
C:\Windows\WinSxS\amd64_microsoft-windows-s..extinput.additional_31bf3856ad364e35_10.0.18362.1_none_861edb6aa88ba54e{code}
However I have _several_ 52 byte invalid font files in folders starting with
{code:java}
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35{code}
like in the crash report.

Those won't even open to preview/install into Windows on my PC, so it's a bit weird that this person's copy from there is getting detected. I've attached the very small invalid copy of the font file.


was (Author: kwilkerson):
This was on a customer's machine, so I can't guarantee that I'm providing the same files. However, I dug around in one of my Windows 10 PCs and found several copies of ecmdl2.ttf (EC MDL2 Assets).

I have a correct (previewable in Windows) copy in two places:
{code:java}
C:\Windows\SystemResources\TextInput\Assets\Fonts{code}
{code:java}
C:\Windows\WinSxS\amd64_microsoft-windows-s..extinput.additional_31bf3856ad364e35_10.0.18362.1_none_861edb6aa88ba54e{code}
However I have _several_ 52 byte invalid font files in folders starting with
{code:java}
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35{code}
like in the crash report.

Those won't even open to preview/install into Windows on my PC, so it's a bit weird that this person's copy from there is getting detected. I've attached the very small invalid copy of the font file.

> Invalid TTC file causes NullPointerException
> --------------------------------------------
>
>                 Key: FOP-3004
>                 URL: https://issues.apache.org/jira/browse/FOP-3004
>             Project: FOP
>          Issue Type: Bug
>          Components: font/opentype, font/unqualified
>    Affects Versions: trunk
>            Reporter: Kelly H Wilkerson
>            Priority: Minor
>         Attachments: ecmdl2.ttf, ttcIssue.diff
>
>
> A broken TTC on a customer's Windows 10 machine caused a NPE.
> {code:java}
> org.apache.fop.fonts.truetype.OpenFont.getTTCnames(){code}
> returns null (after logging SEVERE: Not a TTC!) and then
> {code:java}
> org.apache.fop.fonts.autodetect.FontInfoFinder.find()
> {code}
> doesn't check the result before iterating on it. But a quick null check on ttcNames fixes the issue. (diff attached.)
> Here's the stack trace with the logging right before as well.
> {code:java}
> WARNING: Unable to load font file: file:/C:/Windows/servicing/LCU/Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.1016.1.5/amd64_microsoft-windows-ecapp.appxmain_31bf3856ad364e35_10.0.18362.997_none_52b446c91de63187/r/ecmdl2.ttf. Reason: java.io.EOFException: Reached EOF, file size=52
> Mar 10, 2021 5:08:12 PM org.apache.fop.fonts.truetype.OpenFont getTTCnames
> SEVERE: Not a TTC!
> java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "ttcNames" is null
> 	at org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:219)
> 	at org.apache.fop.fonts.FontAdder.add(FontAdder.java:63)
> 	at org.apache.fop.fonts.FontDetectorFactory$DefaultFontDetector.detect(FontDetectorFactory.java:97)
> 	at org.apache.fop.fonts.FontManager.autoDetectFonts(FontManager.java:229)
> 	at org.apache.fop.fonts.DefaultFontConfigurator.configure(DefaultFontConfigurator.java:82)
> 	at org.apache.fop.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147)
> 	at org.apache.fop.render.PrintRendererConfigurator.setupFontInfo(PrintRendererConfigurator.java:127)
> 	at org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:170)
> 	at org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:187)
> 	at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:75)
> 	at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
> 	at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
> 	at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
> 	at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
> 	at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
> 	at org.apache.fop.apps.Fop.<init>(Fop.java:78)
> 	at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:184)
> 	at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:242)
> {code}



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