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

Gustavo A. commented on PDFBOX-5382:
------------------------------------

The {{COSDocument}} map limitation that stopped this in 2022 sits under the 
writer as well.
{{COSWriter#write}} seeds its allocator with {{getHighestXRefObjectNumber()}}, 
so a number an
earlier section maps into the free list looks unallocated: an incremental save 
lowers {{/Size}}
below it and can then hand it to a new object. Reproducers in PDFBOX-6252, the 
smallest being a
five-object file whose table marks object 6 free with the list linked 0 -> 6 -> 
end.

It cuts the other way too, which matters if the detection is ever switched back 
on. The check
walks that same map, so it fires on files PDFBox itself writes: saving that 
five-object file with
{{save(f, CompressParameters.NO_COMPRESSION)}} renumbers its objects to 6..10 
and fills 0..5 with
free entries linked into a list -- an entry for every number, no gap anywhere 
-- and the check
then reports five, "Object 1 missing" through "Object 5 missing", one per free 
entry.


> Detect gaps in cross reference table
> ------------------------------------
>
>                 Key: PDFBOX-5382
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5382
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Signing
>    Affects Versions: 2.0.25
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>            Priority: Minor
>
> Detect PDF files with gaps in the cross reference table because these may 
> fail validation in Acrobat Reader, see related SO answer.



--
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