Add array bounds check for xrender format lookup

Before this change, images with RGB30, RGB96F, and RGBA128F formats
would have been given garbage xrender formats; now such images
use the fallback path and are converted to formats with an xrender
equivalent.
This commit is contained in:
Manuel Stoeckl 2021-08-22 15:51:54 -04:00
parent 08194cef53
commit 39179681d4

View file

@ -1266,7 +1266,8 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target,
if (unlikely (status))
return (cairo_xcb_picture_t *) _cairo_surface_create_in_error (status);
if (image->format != CAIRO_FORMAT_INVALID) {
if (image->format != CAIRO_FORMAT_INVALID &&
image->format < ARRAY_LENGTH (target->screen->connection->standard_formats)) {
xcb_render_pictformat_t format;
format = target->screen->connection->standard_formats[image->format];