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

Andreas Lehmkühler commented on PDFBOX-6132:
--------------------------------------------

If such a pdf exists, it has to be somehow special or better broken. Maybe our 
code has an issue as well, so that such a special pdf lead to the described 
issue, instead of throwing an exception or "repairing" the broken part.

> NullPointerException in `COSDocument.getLinearizedDictionary()` when 
> xrefTable contains null key
> ------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-6132
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6132
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.35, 3.0.6 PDFBox
>            Reporter: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.36, 3.0.7 PDFBox, 4.0.0
>
>
> Posted by Haoran Yan on the users mailing list:
> NullPointerException (NPE) in COSDocument. Specifically, when a 
> cross-reference table (xrefTable) containing a null key is added via 
> addXRefTable(), calling getLinearizedDictionary() results in an unhandled NPE 
> at line 219 of COSDocument.java.
> Reproduce:
> Run the following test case:
> {code:java}
> public class TestClass {
>    @Test
>    public void test() {
>        COSDocument document = new COSDocument();
>        Map<COSObjectKey, Long> xrefTable = new HashMap<>();
>        xrefTable.put(null, 10L);
>        document.addXRefTable(xrefTable);
>        document.getLinearizedDictionary();
>   }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to