[cairo-commit] src/cairo-pdf-surface.c

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Thu Feb 7 14:36:55 PST 2008


 src/cairo-pdf-surface.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 80e11a85a95c5f2c814eef90a8e6ab60c8835104
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Thu Feb 7 14:36:39 2008 -0800

    [pdf] restore alpha_size back to correct bit size

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 880c382..e8c7ea4 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1303,7 +1303,11 @@ _cairo_pdf_surface_emit_smask (cairo_pdf_surface_t	*surface,
     stream_ret->id = 0;
 
     if (image->format == CAIRO_FORMAT_A1) {
-	alpha_size = ((image->width+7) / 8) * image->height;
+	/* We allocate using slightly different math so that we can get
+	 * the overflow checking from _cairo_malloc_ab, but alpha_size
+	 * needs to be the correct size for emitting the data in the PDF.
+	 */
+	alpha_size = (image->width*image->height + 7) / 8;
 	alpha = _cairo_malloc_ab ((image->width+7) / 8, image->height);
     } else {
 	alpha_size = image->height * image->width;


More information about the cairo-commit mailing list