pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-2478) NPE in XObjImageValidator.checkColorSpaceAndImageMask
Date Mon, 03 Nov 2014 20:22:34 GMT

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

ASF subversion and git services commented on PDFBOX-2478:
---------------------------------------------------------

Commit 1636431 from [~tilman] in branch 'pdfbox/branches/1.8'
[ https://svn.apache.org/r1636431 ]

PDFBOX-2478: avoid NPE for image masks without bpc

> NPE in XObjImageValidator.checkColorSpaceAndImageMask
> -----------------------------------------------------
>
>                 Key: PDFBOX-2478
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2478
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Preflight
>    Affects Versions: 1.8.7, 1.8.8, 2.0.0
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>             Fix For: 1.8.8, 2.0.0
>
>
> I get this with the file PDFBOX-2376-087731.pdf:
> {code}
> java.lang.NullPointerException
> PDFBOX-2376-179204-EMC.pdf
> 	at org.apache.pdfbox.preflight.xobject.XObjImageValidator.checkColorSpaceAndImageMask(XObjImageValidator.java:132)
> 	at org.apache.pdfbox.preflight.xobject.XObjImageValidator.validate(XObjImageValidator.java:183)
> 	at org.apache.pdfbox.preflight.process.reflect.GraphicObjectPageValidationProcess.validate(GraphicObjectPageValidationProcess.java:70)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:52)
> 	at org.apache.pdfbox.preflight.process.reflect.ResourcesValidationProcess.validateXObjects(ResourcesValidationProcess.java:288)
> 	at org.apache.pdfbox.preflight.process.reflect.ResourcesValidationProcess.validate(ResourcesValidationProcess.java:80)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:52)
> 	at org.apache.pdfbox.preflight.process.reflect.SinglePageValidationProcess.validateResources(SinglePageValidationProcess.java:167)
> 	at org.apache.pdfbox.preflight.process.reflect.SinglePageValidationProcess.validate(SinglePageValidationProcess.java:82)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:52)
> 	at org.apache.pdfbox.preflight.process.PageTreeValidationProcess.validatePage(PageTreeValidationProcess.java:56)
> 	at org.apache.pdfbox.preflight.process.PageTreeValidationProcess.validate(PageTreeValidationProcess.java:45)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:88)
> 	at org.apache.pdfbox.preflight.PreflightDocument.validate(PreflightDocument.java:168)
> 	at pdfboxpageimageextraction.PreflightTest.main(PreflightTest.java:47)
> {code}
> The cause is this piece of code:
> {code}
>             Integer bitsPerCompValue = COSUtils.getAsInteger(bitsPerComp, cosDocument);
>             if (bitsPerCompValue != 1)
> {code}
> which fails on this input:
> {code}
> 44 0 obj<</Length 289/Filter/CCITTFaxDecode/DecodeParms<</K -1/Columns 282/Rows
40>>/Width 282/Height 40/ImageMask true/Subtype/Image>>
> {code}
> That segment is called only for image masks. The spec does not require BitsPerComponent
for image masks, but if it is there, it must be 1. So all I have to do is to add a null check.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message