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

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

The changes of this ticket didn't introduce the issue Tilman found but 
obviously they somehow reveal an issue with the brute force parser. When 
rebuilding the trailer information the parser doesn't take the order of the 
parsed objects into account. Accidentally it works in some environments, but it 
it fails in others as an outdated object overwrote a newer one. I've overhauled 
the code so that an older object can't overwrite a new one any more.

> Issue with COSObjectKey::fixGeneration
> --------------------------------------
>
>                 Key: PDFBOX-5151
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5151
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 2.0.23, 3.0.3 JBIG2
>            Reporter: Roland Meub
>            Assignee: Andreas Lehmkühler
>            Priority: Major
>             Fix For: 2.0.24, 3.0.0 PDFBox
>
>         Attachments: pdfbox-fixGeneration-bugfix.patch
>
>
> I think, I've just found a little bug within 
> COSParser::validateXrefOffsets, which occures when a xref generation is 
> corrected using COSObjectKey::fixGeneration. 
>  
> The issue is, that COSObjectKey is used as a hash-key and this instance 
> is modified with fixGeneration. 
> Because of this modification, the hasCode of the COSObjectKey is changed 
> and the associated hashmap entry cannot longer be found in the xrefTable. 
> Hashmap key objects should better be immutabel (see 
> [https://howtodoinjava.com/java/collections/hashmap/design-good-key-for-hashmap/])
>  
> According to the change history, this issue was introduced with a commit 
> for PDFBOX-4153, but PDFBOX-4490 seems also be related.
>  
> Attached patch-file contains bot, the bugfix and the proposed optimization 
> within COSObjectKey.



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

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

Reply via email to