mirror of
https://salsa.debian.org/xorg-team/lib/pixman
synced 2026-08-09 05:09:56 +00:00
stress-test: Avoid overflows in clip rectangles
The rectangles in the clip region set in set_general_properties()
would sometimes overflow, which would lead to messages like these:
*** BUG ***
In pixman_region32_union_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug
when the micro version number of pixman is even.
Fix this by detecting the overflow and clamping such that the x2/y2
coordinates are less than INT32_MAX.
This commit is contained in:
parent
24d83cbf3d
commit
38fe7cd7be
@ -468,6 +468,11 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
|
||||
width = lcg_rand_n (image->bits.width) - x + 10;
|
||||
height = lcg_rand_n (image->bits.height) - y + 10;
|
||||
|
||||
if (width + x < x)
|
||||
width = INT32_MAX - x;
|
||||
if (height + y < y)
|
||||
height = INT32_MAX - y;
|
||||
|
||||
pixman_region32_union_rect (
|
||||
®ion, ®ion, x, y, width, height);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user