From 76e961950be5e8ffda092ac64dec7d767920ff20 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 7 Aug 2005 23:56:44 +0000 Subject: [PATCH] Fix %%EOF checking svn path=/branches/KDE/3.5/kdegraphics/kpdf/; revision=443937 --- xpdf/xpdf/PDFDoc.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xpdf/xpdf/PDFDoc.cc b/xpdf/xpdf/PDFDoc.cc index 96d99c359..5a170676b 100644 --- a/xpdf/xpdf/PDFDoc.cc +++ b/xpdf/xpdf/PDFDoc.cc @@ -127,7 +127,15 @@ GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) { 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 does not have ending %%EOF"); errCode = errDamaged;