mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 02:58:02 +02:00
xcb: Add dimension guards to create-similar-image
Just create a image wrapper for a 0x0 surface, and do not try to create an image surface that is larger than the maximum X coordinate. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
5045155de6
commit
9e4fb906b8
1 changed files with 7 additions and 0 deletions
|
|
@ -172,6 +172,12 @@ _cairo_xcb_surface_create_similar_image (void *abstract_other,
|
|||
cairo_status_t status;
|
||||
pixman_format_code_t pixman_format;
|
||||
|
||||
if (unlikely(width > XLIB_COORD_MAX ||
|
||||
height > XLIB_COORD_MAX ||
|
||||
width <= 0 ||
|
||||
height <= 0))
|
||||
return NULL;
|
||||
|
||||
pixman_format = _cairo_format_to_pixman_format_code (format);
|
||||
|
||||
status = _cairo_xcb_shm_image_create (connection, pixman_format,
|
||||
|
|
@ -179,6 +185,7 @@ _cairo_xcb_surface_create_similar_image (void *abstract_other,
|
|||
&shm_info);
|
||||
if (unlikely (status))
|
||||
return _cairo_surface_create_in_error (status);
|
||||
|
||||
return &image->base;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue