gfx/cairo/zero-sized.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
     2 index e9e544d..cde68a1 100644
     3 --- a/src/cairo-image-surface.c
     4 +++ b/src/cairo-image-surface.c
     5 @@ -324,8 +324,8 @@ _cairo_image_surface_create_with_pixman_format (unsigned char		*data,
     6      cairo_surface_t *surface;
     7      pixman_image_t *pixman_image;
     9 -    pixman_image = pixman_image_create_bits (pixman_format, width, height,
    10 -					     (uint32_t *) data, stride);
    11 +    pixman_image = pixman_image_create_bits (pixman_format, width ? width : 1, height ? height : 1,
    12 +					     (uint32_t *) data, stride ? stride : 4);
    14      if (unlikely (pixman_image == NULL))
    15  	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
    16 diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
    17 index f86a133..ddcb600 100644
    18 --- a/src/cairo-xlib-surface.c
    19 +++ b/src/cairo-xlib-surface.c
    20 @@ -675,7 +675,8 @@ _get_image_surface (cairo_xlib_surface_t    *surface,
    22  	pixmap = XCreatePixmap (surface->dpy,
    23  				surface->drawable,
    24 -				extents.width, extents.height,
    25 +				extents.width <= 0 ? 1 : extents.width,
    26 +				extents.height <= 0 ? 1 : extents.height,
    27  				surface->depth);
    28  	if (pixmap) {
    29  	    XCopyArea (surface->dpy, surface->drawable, pixmap, surface->gc,
    30 @@ -686,7 +687,8 @@ _get_image_surface (cairo_xlib_surface_t    *surface,
    31  	    ximage = XGetImage (surface->dpy,
    32  				pixmap,
    33  				0, 0,
    34 -				extents.width, extents.height,
    35 +				extents.width <= 0 ? 1 : extents.width,
    36 +				extents.height <= 0 ? 1 : extents.height,
    37  				AllPlanes, ZPixmap);
    39  	    XFreePixmap (surface->dpy, pixmap);

mercurial