]> git.parisson.com Git - pdf.js.git/commitdiff
Scan for startxref more than 1024 chars from end #828
authorfixplz <gust.tgm@gmail.com>
Fri, 2 Dec 2011 22:33:00 +0000 (00:33 +0200)
committerfixplz <gust.tgm@gmail.com>
Fri, 2 Dec 2011 22:33:00 +0000 (00:33 +0200)
src/core.js

index 6b7845efd133f0025e38e37e8919fdde7670ed47..9c9be921876db8e45134c84678d48f0f2f959927 100644 (file)
@@ -382,11 +382,15 @@ var PDFDocModel = (function pdfDoc() {
           startXRef = stream.pos + 6;
       } else {
         // Find startxref at the end of the file.
-        var start = stream.end - 1024;
-        if (start < 0)
-          start = 0;
-        stream.pos = start;
-        if (find(stream, 'startxref', 1024, true)) {
+        var found = false, pos = stream.end;
+        while(!found && pos > 0) {
+          pos -= 1024;
+          if (pos < 0)
+            pos = 0;
+          stream.pos = pos;
+          found = find(stream, 'startxref', 1024, true);
+        }
+        if (found) {
           stream.skip(9);
           var ch;
           do {