[poppler] poppler/poppler: PDFDoc.cc,1.2,1.3

Albert Astals Cid aacid at freedesktop.org
Sat Aug 6 21:47:39 EST 2005


Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv16924/poppler

Modified Files:
	PDFDoc.cc 
Log Message:
Increase EOF searching up to last 1024 characters


Index: PDFDoc.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/PDFDoc.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PDFDoc.cc	6 Jul 2005 13:29:00 -0000	1.2
+++ PDFDoc.cc	6 Aug 2005 11:47:37 -0000	1.3
@@ -177,23 +177,26 @@
 // Check for a %%EOF at the end of this stream
 GBool PDFDoc::checkFooter() {
   // we look in the last 7 chars because it can be %%EOF %%EOF\n %%EOF\n\r etc
-  char eof[8];
+  char *eof = new char[1025];
   int pos = str->getPos();
-  str->setPos(7, -1);
-  eof[0] = str->getChar();
-  eof[1] = str->getChar();
-  eof[2] = str->getChar();
-  eof[3] = str->getChar();
-  eof[4] = str->getChar();
-  eof[5] = str->getChar();
-  eof[6] = str->getChar();
-  eof[7] = '\0';
+  str->setPos(1024, -1);
+  int i, ch;
+  for (i = 0; i < 1024; i++)
+  {
+    ch = str->getChar();
+    if (ch == EOF)
+      break;
+    eof[i] = ch;
+  }
+  eof[i] = '\0';
   if (strstr(eof, "%%EOF") == NULL)
   {
     error(-1, "Document has not the mandatory ending %%EOF");
     errCode = errDamaged;
+    delete[] eof;
     return gFalse;
   }
+  delete[] eof;
   str->setPos(pos);
   return gTrue;
 }



More information about the poppler mailing list