In my continuing saga of attempting to fill in tax forms in evince...

The PDF causing trouble now is this one:
    http://www.ftb.ca.gov/forms/07_forms/07_540.pdf

It loads in evince just fine. When going to print it out, I run into trouble. Printing to PostScript results in something that gives the Ghostscript interpreter errors. Printing to PDF and then attempting to load the PDF printout back into evince yields this:

evince: CairoOutputDev.cc:1155: void CairoOutputDev::drawImageMaskPrescaled(GfxState*, Object*, Stream*, int, int, GBool, GBool): Assertion `0 && "over run\n"' failed.

The printed PDF has
    Creator:        cairo 1.4.14 (http://cairographics.org)
Investigating in a bit more detail, it turns out that the generated PDF includes a Type 3 font, one of whose characters includes a 0x0 bitmap. This is what leads to the assertion above. I can send a copy of the (probably invalid) generated PDF if anyone is interested.

I haven't figured out what causes an invalid PDF to be generated when printing, and building against a newer version of cairo seems to fix the problem. So, this looks like it could be a cairo bug (now fixed), and not anything in poppler. Still, the attached patch might be useful--if poppler encounters a bitmap with invalid dimensions, cause it to bail out early instead of trying to display it.

With a new version of cairo and this patch, I'm now getting "cairo context error: invalid matrix (not invertible)" errors and a partially-rendered page instead of a crash on the bad PDF. Not completely sure what parts are due to the cairo update and what to this patch, but the patch at least shouldn't hurt...

--Michael Vrable
If a bitmap's dimensions are invalid, do not try to display it.
---
 poppler/Gfx.cc |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index f068088..3ae897e 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -3523,6 +3523,9 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
     goto err2;
   obj1.free();
 
+  if (width < 1 || height < 1)
+    goto err1;
+
   // image or mask?
   dict->lookup("ImageMask", &obj1);
   if (obj1.isNull()) {
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to