Skip to content

Commit

Permalink
win32: Fix crash from win32 surface's image size too small
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Massimo Valentini authored and Bryce Harrington committed Feb 3, 2015
1 parent cca8b19 commit 91f128b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/win32/cairo-win32-display-surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 91f128b

Please sign in to comment.