diff --git "a/C:\\Users\\LIJUNL~1.SIP\\AppData\\Local\\Temp\\TortoiseGit\\PDF589B.tmp\\PDFDoc-07aa6f4-left.cc" "b/D:\\poppler\\poppler\\PDFDoc.cc" index ec8d3df..8c38017 100644 --- "a/C:\\Users\\LIJUNL~1.SIP\\AppData\\Local\\Temp\\TortoiseGit\\PDF589B.tmp\\PDFDoc-07aa6f4-left.cc" +++ "b/D:\\poppler\\poppler\\PDFDoc.cc" @@ -1820,27 +1820,34 @@ Goffset PDFDoc::getStartXRef(GBool tryingToReconstruct) int c, n, i; // read last xrefSearchSize bytes - str->setPos(xrefSearchSize, -1); - for (n = 0; n < xrefSearchSize; ++n) { - if ((c = str->getChar()) == EOF) { - break; - } - buf[n] = c; - } - buf[n] = '\0'; - - // find startxref - for (i = n - 9; i >= 0; --i) { - if (!strncmp(&buf[i], "startxref", 9)) { - break; - } - } - if (i < 0) { - startXRefPos = 0; - } else { - for (p = &buf[i+9]; isspace(*p); ++p) ; - startXRefPos = strToLongLong(p); - } + int segnum = 0; + for (; (xrefSearchSize - 16)*segnum < str->getLength(); segnum++) + { + str->setPos((xrefSearchSize - 16)*segnum + xrefSearchSize, -1); + for (n = 0; n < xrefSearchSize; ++n) { + if ((c = str->getChar()) == EOF) { + break; + } + buf[n] = c; + } + buf[n] = '\0'; + + // find startxref + for (i = n - 9; i >= 0; --i) { + if (!strncmp(&buf[i], "startxref", 9)) { + break; + } + } + if (i < 0) { + startXRefPos = 0; + } + else { + for (p = &buf[i + 9]; isspace(*p); ++p); + startXRefPos = strToLongLong(p); + break; + } + + } } }