summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2005-08-07 23:58:12 +0000
committerAlbert Astals Cid <aacid@kde.org>2005-08-07 23:58:12 +0000
commit5dc9b14b99f2efa2fe018e9267dd363d1bcd78b1 (patch)
tree47cdd5ebe8636d8fbf9a67c6feb64c07568b9d52
parent155d019d7b474f244a3e4bf64d192015f6a266c4 (diff)
Fix EOF checkingpoppler-0.4.0
-rw-r--r--ChangeLog4
-rw-r--r--poppler/PDFDoc.cc10
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 35d04fd8..be8f0934 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-08 Albert Astals Cid <aacid@kde.org>
+
+ * poppler/PDFDoc.cc: Improve the checking for %%EOF
+
2005-08-06 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-page.cc:
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 129695a4..750a5ec7 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -189,7 +189,15 @@ GBool PDFDoc::checkFooter() {
eof[i] = ch;
}
eof[i] = '\0';
- if (strstr(eof, "%%EOF") == NULL)
+
+ bool found = false;
+ for (i = i - 5; i >= 0; i--) {
+ if (strncmp (&eof[i], "%%EOF", 5) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
{
error(-1, "Document has not the mandatory ending %%EOF");
errCode = errDamaged;