[poppler] Cannot open in poppler 0.22.1 a file saved after large file support patches

Fabio D'Urso fabiodurso at hotmail.it
Thu Apr 25 13:57:17 PDT 2013


On Saturday, February 16, 2013 10:57:36 AM Adrian Johnson wrote:
> On 16/02/13 09:53, Fabio D'Urso wrote:
> > Hi,
> > 
> > I'm not able to open files saved by git-master poppler in poppler 0.22:
> > Syntax Error: Couldn't find trailer dictionary
> > Syntax Error: Couldn't read xref table
> > 
> > I noticed that large file support patches changed how we write incremental
> > updates of XRef streams. In particular I'm referring to
> > XRef::XRefStreamWriter::writeEntry and XRef::writeStreamToBuffer.
> > 
> > Previously we used to write 4-bytes offsets in XRef streams, now we always
> > write 8-bytes offsets (sizeof(Goffset)).
> > If I understand correctly older poppler versions are not able to read
> > those files because they don't have large file support.
> > 
> > In other words, even if the files we create are good, all previous poppler
> > versions (including 0.22.1) are not able to open them back.
> 
> Could you open a bug to track this issue.

Sorry, I haven't opened a bug. But I've written patches :)

> > Maybe we had better keep emitting 4-bytes entries for compatibility when
> > possible (i.e. if no offset exceeds the 4GB limit), what do you think?
> 
> Yes it would be best to check if all offsets in the xref stream are less
> than 4GB and if so, write 4 byte offsets.

This is done in the first attached patch.

I've also attached two other patches that fix a printf format specifier (%i 
should now be %lli because it refers to a Goffset).
The second patch adds the printf-format attribute to OutStream::printf, so the 
compiler can spot this kind of errors. The third one is the actual fix.
This fixes the startxref value being sometimes negative on little-endian cpus 
where int is 32-bit, and zero on big-endian cpus where int is 32-bit.

Fabio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-XRef-stream-writing-Write-32-bit-offsets-when-possib.patch
Type: text/x-patch
Size: 5304 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20130425/a1d9d41c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Re-enable-commented-out-printf-format-attribute-on-O.patch
Type: text/x-patch
Size: 1720 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20130425/a1d9d41c/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Fix-printf-format-specifiers-Goffset-is-a-long-long-.patch
Type: text/x-patch
Size: 1623 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20130425/a1d9d41c/attachment-0002.bin>


More information about the poppler mailing list