summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimo Valentini <mvalentini@src.gnome.org>2013-09-11 18:10:38 +0200
committerBryce Harrington <bryce@osg.samsung.com>2015-02-02 16:33:06 -0800
commit91f128bf7a1233a7fc2e164f95279987e32a3532 (patch)
treeaf30014dc2806fd7ee0573a2765ebafe66c20ad2
parentcca8b1960b0091c53235d9dc4cde8a33010c5bbf (diff)
win32: Fix crash from win32 surface's image size too small
Beginning in 1.12, a crash can occur when the win32 surface's image size does not cover the entire surface (e.g. due to clipping regions). This patch enlarges the fallback surface created of the amount necessary not to write past the end of the DIB. It assumes that Clip applied to an HDC are clamped to (0,0,width,height) of the HDC. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=53121 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
-rw-r--r--src/win32/cairo-win32-display-surface.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c
index 5ecdbee3e..965f2c45d 100644
--- a/src/win32/cairo-win32-display-surface.c
+++ b/src/win32/cairo-win32-display-surface.c
@@ -455,17 +455,17 @@ _cairo_win32_display_surface_map_to_image (void *abstract_sur
surface->fallback =
_cairo_win32_display_surface_create_for_dc (surface->win32.dc,
surface->win32.format,
- surface->win32.extents.width,
- surface->win32.extents.height);
+ surface->win32.extents.x + surface->win32.extents.width,
+ surface->win32.extents.y + surface->win32.extents.height);
if (unlikely (status = surface->fallback->status))
goto err;
if (!BitBlt (to_win32_surface(surface->fallback)->dc,
- 0, 0,
+ surface->win32.extents.x, surface->win32.extents.y,
surface->win32.extents.width,
surface->win32.extents.height,
surface->win32.dc,
- 0, 0,
+ surface->win32.extents.x, surface->win32.extents.y,
SRCCOPY)) {
status = _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
goto err;