Bug 93882

Summary: Some forms are not saved
Product: poppler Reporter: Marek Kasik <mkasik>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Mark holes in xref table as free entries

Description Marek Kasik 2016-01-27 10:45:09 UTC
Created attachment 121323 [details]
Mark holes in xref table as free entries

I've got downstream report with a PDF form which doesn't save entered data. I've looked at this in more detail and it seems that the problem is caused by reconstruction of xref table before saving of the form which causes "reset" of the form.
The reconstruction is performed because there is a call for XRef::getEntry() on entry which does not exist (with i = 7 btw). This entry doesn't exist because there is a hole in the xref table. I was not sure whether the table is correct then but from https://bugs.freedesktop.org/show_bug.cgi?id=48679 it seems that it is (and note 17 on section 3.4.3 in specification of PDF 1.7 says that we should treat such holes as free entries).

Attached is a patch which works for me but I'm not sure whether it doesn't add another bug elsewhere. It marks newly added entries which where not listed in previous sections of xref table as free. It doesn't do this if previous size of the xref table was 0 because this indicates that the PDF is probably linearized and it would mark some entries as free even if those will be populated later.

It doesn't "chain" the free entries but it seems that it work even without that (otherwise we would need to reuse the code from beginning of XRef::writeXRef() which does this).

The original report and the reproducer can be found here: https://bugzilla.redhat.com/show_bug.cgi?id=1301016
Comment 1 GitLab Migration User 2018-08-21 11:03:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/483.

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.