tags 639614 + patch
kthxbye

To fix this bug, I first tried to make sure that the title member of
OutlineItem was non-NULL if titleLen is 0.  This, unfortunately, does
not fix the problem.  Neither okular nor evince render the missing
outline trees.  It's unclear to me what is intrinsically preventing them
from rendering outline items with a zero-length title, since this is
perfectly valid according to PDF 1.4.

As a workaround, I've changed the code so that if the length of the
string is 0, to create a string containing only the Unicode character
U+200B, ZERO WIDTH SPACE.  This works in both programs, but it's really
just a hack.  The code should be fixed to do something sane and
reasonable, but I'm not familiar enough with it to determine what that
should be (although it very well may break the ABI, which is even more
reason for a deliberate and well-thought-out decision).

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
diff -ur poppler.old/poppler/Outline.cc poppler-0.16.7/poppler/Outline.cc
--- poppler.old/poppler/Outline.cc	2011-08-28 18:12:21.053836838 +0000
+++ poppler-0.16.7/poppler/Outline.cc	2011-08-28 19:13:05.092421558 +0000
@@ -72,7 +72,11 @@
 
   if (dict->lookup("Title", &obj1)->isString()) {
     s = obj1.getString();
-    if ((s->getChar(0) & 0xff) == 0xfe &&
+    if (!s->getLength()) {
+      titleLen = 1;
+      title = (Unicode *)gmallocn(1, sizeof(Unicode));
+      title[0] = 0x200b;
+    } else if ((s->getChar(0) & 0xff) == 0xfe &&
 	(s->getChar(1) & 0xff) == 0xff) {
       titleLen = (s->getLength() - 2) / 2;
       title = (Unicode *)gmallocn(titleLen, sizeof(Unicode));

Attachment: signature.asc
Description: Digital signature

Reply via email to