[poppler] Patches for SplashBitmap/PNGWriter

Albert Astals Cid aacid at kde.org
Wed Aug 18 13:54:21 PDT 2010


A Dimarts, 20 de juliol de 2010, Stefan Thomas va escriure:
>   Merged patches into one and fixed last two compiler warnings.
> 
> @Albert: Assuming you agree with me on the duplicate code issue, this
> should be ready to be committed.

There are memory leaks in

+      if (!writer->close()) {
+        return splashErrGeneric;
+      }
       delete[] row;

When the writer fails to close, right?

Albert

> 
> On 7/16/2010 3:32 PM, Albert Astals Cid wrote:
> > A Dissabte, 10 de juliol de 2010, Stefan Thomas va escriure:
> >> Hello!
> >> 
> >> I've got two new patches for the cause.
> >> 
> >> The first one adds transparent PNG support to PNGWriter and
> >> SplashBitmap. The uses for this are varied and many, so I think it makes
> >> sense to add this to the mainline, even though I don't have the pdftoppm
> >> patch to go along with it. (We're using it in a custom SplashOutputDev.)
> > 
> > Seems like it duplicates some code from the other method, would it be
> > possible to merge them a bit more?
> > 
> >> The second one fixes a nasty bug in SplashBitmap that causes "pdftoppm
> >> -jpeg" to randomly produce corrupt images. Currently SplashBitmap frees
> >> its temporary buffers and later calls ImgWriter::close(). Problem is
> >> libjpeg still uses these temporary buffers during
> >> jpeg_finish_compress(). So if they've been reclaimed - bad things
> >> happen. Usually libjpeg aborts and produces an image with the bottom
> >> fifty or so rows missing. The patch also fixes the SplashBitmap throwing
> >> a splashErrGeneric despite success, which was due to a missing question
> >> mark before writer->close().
> > 
> > valgrind does not complain about it when i do
> > 
> >    valgrind ./utils/pdftoppm -jpeg ~/pdf_reference_1-7.pdf -f 1 -l 1 foo
> > 
> > Are you sure that is the problem?
> > 
> > Albert
> > 
> >> Hope you find it useful.
> >> 
> >> Cheers,
> >> 
> >> Stefan Thomas
> > 
> > _______________________________________________
> > poppler mailing list
> > poppler at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/poppler


More information about the poppler mailing list