[poppler] Unicode page labels should not contain a NUL at the end

Fabio D'Urso fabiodurso at hotmail.it
Sun Apr 8 14:29:13 PDT 2012


The attached one-page document (generated with TexLive 2011 by an Okular user) 
labels its only page with the unicode string "1" <FEFF0031>.
In qt4, Page::label() returns a QString containing "1\0" (i.e. 2 character 
long with a NUL character at the end). I haven't tested, but I think the same 
goes for the other frontends.

I think that the issue is in PageLabelInfo::indexToLabel, because it's here 
where the extra NUL is appended.
This extra NUL seems to be wrong, because GooStrings are not NUL terminated in 
the non-unicode case.
It also confuses Okular, making it assume that page labels differ from page 
indices.

I'm attaching a patch that removes the NUL at the end.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.pdf
Type: application/pdf
Size: 18929 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120408/bad047e7/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-FIX-Do-not-append-a-NUL-character-to-Unicode-page-la.patch
Type: text/x-patch
Size: 774 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120408/bad047e7/attachment.bin>


More information about the poppler mailing list