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