mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-10 10:30:21 +01:00
gl: Check against user-provided invalid sizes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
3edf369ead
commit
d7dcf9d28f
3 changed files with 9 additions and 0 deletions
|
|
@ -218,6 +218,9 @@ cairo_gl_surface_create_for_egl (cairo_device_t *device,
|
|||
if (device->backend->type != CAIRO_DEVICE_TYPE_GL)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
|
||||
|
||||
if (width <= 0 || height <= 0)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
|
||||
|
||||
surface = calloc (1, sizeof (cairo_egl_surface_t));
|
||||
if (unlikely (surface == NULL))
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
|
||||
|
|
|
|||
|
|
@ -265,6 +265,9 @@ cairo_gl_surface_create_for_window (cairo_device_t *device,
|
|||
if (device->backend->type != CAIRO_DEVICE_TYPE_GL)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
|
||||
|
||||
if (width <= 0 || height <= 0)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
|
||||
|
||||
surface = calloc (1, sizeof (cairo_glx_surface_t));
|
||||
if (unlikely (surface == NULL))
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
|
||||
|
|
|
|||
|
|
@ -246,6 +246,9 @@ cairo_gl_surface_create_for_dc (cairo_device_t *device,
|
|||
if (device->backend->type != CAIRO_DEVICE_TYPE_GL)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
|
||||
|
||||
if (width <= 0 || height <= 0)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
|
||||
|
||||
surface = calloc (1, sizeof (cairo_wgl_surface_t));
|
||||
if (unlikely (surface == NULL))
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue