[pattern] Beware unsigned wrap-around with pathological surface patterns.

A surface pattern under an extreme transformation could lie entirely in
the negative quadrant. This would trigger the fixup such that it's lower
left corner was clamped to the origin, but the upper right corner was left
unchecked. This could result in the width,height being negative and
wrapping around to large values instead of being clamped to 0.
This commit is contained in:
Chris Wilson 2008-09-23 23:19:02 +01:00
parent 3c6d3684e9
commit 8f51ea4657

View file

@ -1821,8 +1821,8 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern,
*/
x = MAX (0, floor (x1) - 1);
y = MAX (0, floor (y1) - 1);
width = MIN (extents.width, ceil (x2) + 1) - x;
height = MIN (extents.height, ceil (y2) + 1) - y;
width = MAX (MIN (extents.width, ceil (x2) + 1) - x, 0);
height = MAX (MIN (extents.height, ceil (y2) + 1) - y, 0);
}
x += tx;
y += ty;