[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2008-02-07 22:41:44
Message-ID: 1202424104.231679.11445.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 772156 by aacid:

PDF spec says name tokens have a maximum length of 127, but there are some docs in \
the wild with more than that and they work on acroread so increase the allowed length \
to 128+127


 M  +18 -4     Lexer.cc  


--- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/Lexer.cc #772155:772156
@@ -329,6 +329,7 @@
   case '/':
     p = tokBuf;
     n = 0;
+    s = NULL;
     while ((c = lookChar()) != EOF && !specialChars[c]) {
       getChar();
       if (c == '#') {
@@ -356,14 +357,27 @@
 	}
       }
      notEscChar:
-      if (++n == tokBufSize) {
-	error(getPos(), "Name token too long");
-	break;
+      if (n == tokBufSize) {
+	if (!s)
+	  s = new GooString(tokBuf, tokBufSize);
+	else
+	{
+	  // the spec says 127 is the maximum, we are already at 256 so bail out
+	  error(getPos(), "Name token too long");
+	  break;
+	}
+	p = tokBuf;
+	n = 0;
       }
       *p++ = c;
+      ++n;
     }
     *p = '\0';
-    obj->initName(tokBuf);
+    if (s) {
+      s->append(tokBuf, n);
+      obj->initName(s->getCString());
+      delete s;
+    } else obj->initName(tokBuf);
     break;
 
   // array punctuation


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic