Bug 90790

Summary: pdfunite: invalid cross reference table
Product: poppler Reporter: Vovodroid <qa23d-vvd>
Component: utilsAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: Thomas.Freitag
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://stackoverflow.com/questions/30526254/sign-concatenated-pdf-in-append-mode-with-certified-no-changes-allowed
Whiteboard:
i915 platform: i915 features:
Attachments: Fix for xref table creation

Description Vovodroid 2015-05-31 09:12:13 UTC
After merge cross reference table in not fully correct, that causes problem with PDF signing.

All details, analysis and samples are here: http://stackoverflow.com/questions/30526254/sign-concatenated-pdf-in-append-mode-with-certified-no-changes-allowed
Comment 1 Vovodroid 2015-06-04 04:51:15 UTC
Created attachment 116275 [details] [review]
Fix for xref table creation

Suggested fix: here is the line   "PDFDoc::writeXRefTableTrailer(trailerDict, yRef, gFalse /* do not write unnecessary entries */," in pdfunite.cc

Change gFalse to gTrue fixes the problem.
Comment 2 Albert Astals Cid 2015-06-19 19:32:05 UTC
Thomas?
Comment 3 Thomas Freitag 2015-06-22 10:18:58 UTC
(In reply to Albert Astals Cid from comment #2)
> Thomas?

The review for the patch is okay. But I must admit that I can't really follow the arguments in http://stackoverflow.com/questions/30526254/sign-concatenated-pdf-in-append-mode-with-certified-no-changes-allowed.
Yes, according to section 7.5.4 Cross-Reference Table of ISO 32000-1 (http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf) 2g.pdf is a modified PDF document. But why not? I can argue that pdfunite modifies the orginal g.pdf in the way that it adds a second page, which is in this case the same g.pdf.
Therefore in my eyes itext should completely rewrite the PDF document when using the parameter CERTIFIED_NO_CHANGES_ALLOWED!!! Or it should deny to use this option with any modified PDF.
But nevertheless, we can also argue that pdfunite should write a complete unmodified PDF, and since the usage of the parameter "writeAllEntries" does exactly this and also produces a well formed, just unmodified, PDF I can live with this change.
Comment 4 Albert Astals Cid 2015-07-03 18:19:28 UTC
Actaully vovodroid i'll need your name so i can include it in the changelog.
Comment 5 Vovodroid 2015-07-03 18:27:34 UTC
First name is Vlad, but I would prefer not disclose my surname.
Comment 6 Vovodroid 2015-07-03 18:32:53 UTC
By a way -  not related to this bug, but what is with https://bugs.freedesktop.org/show_bug.cgi?id=90066 ?
Comment 7 Albert Astals Cid 2015-07-03 19:48:58 UTC
We really need the full name
Comment 8 Vovodroid 2015-07-04 04:50:38 UTC
I really don't want to get it )
Comment 9 Vovodroid 2015-07-04 04:50:53 UTC
to give
Comment 10 Albert Astals Cid 2015-07-04 11:29:19 UTC
That's sad :/

We'll have to find someone else to propose the patch.
Comment 11 Vovodroid 2015-08-28 03:37:41 UTC
OK, I'm Arthur Stavisky, please push this patch to git.
Thanks.
Comment 12 Albert Astals Cid 2015-08-29 13:51:48 UTC
Pushed!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.