[poppler] Re: [Patch] Fix crashes with the cairo backend

Marco Pesenti Gritti mpgritti at gmail.com
Fri Jul 1 03:48:41 PDT 2005


Sometimes I will learn to attach patches...

On 7/1/05, Marco Pesenti Gritti <mpgritti at gmail.com> wrote:
> This just copy a check from the splash backend. Given the render api,
> we should really check to not be rendering outside the pixbuf, because
> both scale and pixbuf are user provided and their size is not
> guaranteed to match.
> Now, the crashes looks like a consequence of the usual rounding issues
> in evince, but as I said the check is really necessary.
> 
> Marco
>
-------------- next part --------------
? a
Index: glib/poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.24
diff -u -r1.24 poppler-page.cc
--- glib/poppler-page.cc	30 Jun 2005 19:44:33 -0000	1.24
+++ glib/poppler-page.cc	1 Jul 2005 10:40:22 -0000
@@ -219,6 +219,11 @@
   pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
   pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
 
+  if (cairo_width > gdk_pixbuf_get_width (pixbuf))
+    cairo_width = gdk_pixbuf_get_width (pixbuf);
+  if (cairo_height > gdk_pixbuf_get_height (pixbuf))
+    cairo_height = gdk_pixbuf_get_height (pixbuf);
+
   for (y = 0; y < cairo_height; y++)
     {
       src = (unsigned int *) (cairo_data + y * cairo_rowstride);


More information about the poppler mailing list