[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.4/kdegraphics/kpdf/xpdf/xpdf
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2005-07-25 20:45:54
Message-ID: 1122324354.968412.29338.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 438717 by aacid:
Work on bad jpeg data that have garbage before the start marker. Fixes poppler bug #3299
M +38 -0 DCTStream.cc
--- branches/KDE/3.4/kdegraphics/kpdf/xpdf/xpdf/DCTStream.cc #438716:438717
@@ -64,6 +64,44 @@
int row_stride;
str->reset();
+
+ // JPEG data has to start with 0xFF 0xD8
+ // but some pdf like the one on
+ // https://bugs.freedesktop.org/show_bug.cgi?id=3299
+ // does have some garbage before that this seeks for
+ // the start marker...
+ bool startFound = false;
+ int c = 0, c2 = 0;
+ int n = 0;
+ while (!startFound)
+ {
+ if (!c)
+ {
+ c = str->getChar();
+ if (c != 0xFF) c = 0;
+ if (c == -1)
+ {
+ error(-1, "Could not find start of jpeg data");
+ exit(1);
+ }
+ }
+ else
+ {
+ c2 = str->getChar();
+ if (c2 != 0xD8)
+ {
+ c = 0;
+ c2 = 0;
+ }
+ else startFound = true;
+ }
+ n++;
+ }
+
+ // ...and this skips the garbage
+ str->reset();
+ for (n = n - 2; n > 0; n--) str->getChar();
+
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic