[poppler] poppler/poppler: DCTStream.cc, 1.4, 1.5 DCTStream.h, 1.5, 1.6

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Jun 28 12:23:54 PDT 2006


Update of /cvs/poppler/poppler/poppler
In directory kemper:/tmp/cvs-serv10860/poppler

Modified Files:
	DCTStream.cc DCTStream.h 
Log Message:
	* poppler/DCTStream.cc:
        * poppler/DCTStream.h: Reset jpeg structures on reset.
        Fixes crash while printing pdf at
        http://bugs.kde.org/attachment.cgi?id=16818&action=view



Index: DCTStream.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/DCTStream.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- DCTStream.cc	5 Jan 2006 23:53:33 -0000	1.4
+++ DCTStream.cc	28 Jun 2006 19:23:52 -0000	1.5
@@ -54,7 +54,16 @@
 
 DCTStream::DCTStream(Stream *strA):
   FilterStream(strA) {
-  
+  init();
+}
+
+DCTStream::~DCTStream() {
+  jpeg_destroy_decompress(&cinfo);
+  delete str;
+}
+
+void DCTStream::init()
+{
   jpeg_create_decompress(&cinfo);
   src.pub.init_source = str_init_source;
   src.pub.fill_input_buffer = str_fill_input_buffer;
@@ -68,18 +77,20 @@
   cinfo.src = (jpeg_source_mgr *)&src;
   cinfo.err = jpeg_std_error(&jerr);
   x = 0;
-}
-
-DCTStream::~DCTStream() {
-  jpeg_destroy_decompress(&cinfo);
-  delete str;
+  row_buffer = NULL;
 }
 
 void DCTStream::reset() {
   int row_stride;
 
   str->reset();
-  
+
+  if (row_buffer)
+  {
+    jpeg_destroy_decompress(&cinfo);
+    init();
+  }
+
   // JPEG data has to start with 0xFF 0xD8
   // but some pdf like the one on 
   // https://bugs.freedesktop.org/show_bug.cgi?id=3299

Index: DCTStream.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/DCTStream.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- DCTStream.h	16 Sep 2005 18:29:18 -0000	1.5
+++ DCTStream.h	28 Jun 2006 19:23:52 -0000	1.6
@@ -61,6 +61,8 @@
   Stream *getRawStream() { return str; }
 
 private:
+  void init();
+
   unsigned int x;
   struct jpeg_decompress_struct cinfo;
   struct jpeg_error_mgr jerr;



More information about the poppler mailing list