[
https://issues.apache.org/jira/browse/PDFBOX-5313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Henry Iguaro updated PDFBOX-5313:
---------------------------------
Description:
Hey guys!
We got a PDF that manages to trigger the following NPE from {{PageDrawer}}:
{code:java}
java.lang.NullPointerException: null
at java.desktop/java.awt.geom.Area.<init>(Area.java:126)
at org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:900)
at
org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:37)
at
org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:933)
{code}
The file even breaks on {{pdf-debugger}} (it fails to render).
*Unfortunately, I can’t share the file.*
Looking at the documentation for
[{{Graphics.getClip()}}|https://docs.oracle.com/javase/6/docs/api/java/awt/Graphics.html#getClip()],
it mentions that the result can be {{null}}, and if {{null}} is passed to the
{{Area}} constructor this ends up in a {{NullPointerException}}. Further
studying the {{PageDrawer}} code, it seems that {{graphics.getClip()}}
shouldn't return {{null}}, however, we proposed a small fix in the following PR
that seems to do the trick:
[https://github.com/apache/pdfbox/pull/133]
was:
Hey guys!
We got a PDF that manages to trigger the following NPE from {{PageDrawer}}:
{code:java}
java.lang.NullPointerException: null
at java.desktop/java.awt.geom.Area.<init>(Area.java:126)
at org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:900)
at
org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:37)
at
org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:933)
{code}
The file even breaks on {{pdf-debugger}} (it fails to render).
*Unfortunately, I can’t share the file.*
{{}}
Looking at the documentation for
[{{Graphics.getClip()}}|https://docs.oracle.com/javase/6/docs/api/java/awt/Graphics.html#getClip()],
it mentions that the result can be {{null}}, and if {{null}} is passed to the
{{Area}} constructor this ends up in a {{NullPointerException}}. Further
studying the {{PageDrawer}} code, it seems that {{graphics.getClip()}}
shouldn't return {{null}}, however, we proposed a small fix in the following PR
that seems to do the trick:
[https://github.com/apache/pdfbox/pull/133]
> `NullPointerException` when intersecting area with null clipping path
> ---------------------------------------------------------------------
>
> Key: PDFBOX-5313
> URL: https://issues.apache.org/jira/browse/PDFBOX-5313
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.24
> Reporter: Henry Iguaro
> Priority: Minor
>
> Hey guys!
> We got a PDF that manages to trigger the following NPE from {{PageDrawer}}:
>
> {code:java}
>
> java.lang.NullPointerException: null
> at java.desktop/java.awt.geom.Area.<init>(Area.java:126)
> at org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:900)
> at
> org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:37)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:933)
>
> {code}
>
> The file even breaks on {{pdf-debugger}} (it fails to render).
>
> *Unfortunately, I can’t share the file.*
> Looking at the documentation for
> [{{Graphics.getClip()}}|https://docs.oracle.com/javase/6/docs/api/java/awt/Graphics.html#getClip()],
> it mentions that the result can be {{null}}, and if {{null}} is passed to
> the {{Area}} constructor this ends up in a {{NullPointerException}}. Further
> studying the {{PageDrawer}} code, it seems that {{graphics.getClip()}}
> shouldn't return {{null}}, however, we proposed a small fix in the following
> PR that seems to do the trick:
> [https://github.com/apache/pdfbox/pull/133]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]