You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/03/01 06:52:00 UTC

[jira] [Commented] (PDFBOX-5381) Catalog object twice in signed file

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

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

Commit 1898495 from lehmi@apache.org in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1898495 ]

PDFBOX-5381: fix test as requested by Tilman

> Catalog object twice in signed file
> -----------------------------------
>
>                 Key: PDFBOX-5381
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5381
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 3.0.0 PDFBox
>            Reporter: Tilman Hausherr
>            Assignee: Andreas Lehmkühler
>            Priority: Major
>              Labels: regression
>             Fix For: 3.0.0 PDFBox
>
>         Attachments: PDFA_signed.pdf
>
>
> The catalog object is twice in the signed file
> {noformat}
> 1 0 obj
> <<
> /Type /Catalog
> /Version /1.4
> /Pages 2 0 R
> /Metadata 3 0 R
> /OutputIntents [4 0 R]
> /Perms 18 0 R
> /AcroForm <<
> /Fields [22 0 R]
> /SigFlags 3
> >>
> >>
> endobj
> 1 0 obj
> <<
> /Type /Catalog
> /Version /1.4
> /Pages 2 0 R
> /Metadata 3 0 R
> /OutputIntents [4 0 R]
> /Perms 18 0 R
> /AcroForm <<
> /Fields [22 0 R]
> /SigFlags 3
> >>
> >>
> endobj
> {noformat}
> here's a failing test, to be added at the end of CreatePDFATest.java (and probably elsewhere)
> {code}
> // Check that no object numbers are double
> File signedFile = new File(signedPdfaFilename);
> BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(signedFile)));
> String line;
> boolean isIncrementalArea = false;
> Set<String> set = new HashSet<>();
> int linePos = 0;
> while ((line = br.readLine()) != null)
> {
>     ++linePos;
>     if (line.equals("%%EOF"))
>     {
>         isIncrementalArea = true;
>     }
>     if (line.equals("%%EOF"))
>     {
>         isIncrementalArea = true;
>         set.clear(); // for cases with several revisions
>     }
>     if (line.matches("^\\d+ 0 obj$"))
>     {
>         int pos = line.indexOf(" 0 obj");
>         line = line.substring(0, pos);
>         assertFalse(set.contains(line), "object '" + line + " 0 obj' twice in incremental part of PDF at line " +linePos);
>         set.add(line);
>     }
> }
> br.close();
> {code}
> I don't know why it happens (although I remember I had such a thing years ago when trying different strategies while working on incremental saving in PDFBOX-45)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org