When fullrewriting https://bugzilla.gnome.org/attachment.cgi?id=166995 we 
currently write a "-000000001 00000 f" entry in the XRef table for object 19.
It is obviously invalid and I'm attaching a patch to fix it.
The -1 value comes from XRefEntry::offset being left to the initial value of 
0xffffffff (which is actually a placeholder for uninitialized value).

Fabio
From 0011600498c19df2bcfeb51c9fd209e9b4e409ff Mon Sep 17 00:00:00 2001
From: Fabio D'Urso <[email protected]>
Date: Tue, 4 Sep 2012 23:10:17 +0200
Subject: [PATCH] Free entries in the xref form a linked list: terminate it
 properly when writing the XRef

The last entry must point back to object 0. Previously it was left
unitialized and resulted in "-000000001 00000 f" being written in the
XRef table.
---
 poppler/XRef.cc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 8559046..81e939a 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1299,6 +1299,7 @@ void XRef::writeXRef(XRef::XRefWriter *writer, GBool writeAllEntries) {
       lastFreeEntry = i;
     }
   }
+  getEntry(lastFreeEntry)->offset = 0;
 
   if (writeAllEntries) {
     writer->startSection(0, size);
-- 
1.7.6.5

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to