mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-22 03:00:29 +01:00
recording: Prevent invalid memory access with zero length command array
If we try to sort a zero length array, we access invalid memory. However, for a zero length command array, we can trivially compute the number of visible indices, 0. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
c51b850bd8
commit
df1ca22ada
1 changed files with 3 additions and 0 deletions
|
|
@ -1586,6 +1586,9 @@ _cairo_recording_surface_get_visible_commands (cairo_recording_surface_t *surfac
|
|||
unsigned int num_visible, *indices;
|
||||
cairo_box_t box;
|
||||
|
||||
if (surface->commands.num_elements == 0)
|
||||
return 0;
|
||||
|
||||
_cairo_box_from_rectangle (&box, extents);
|
||||
|
||||
if (surface->bbtree.chain == INVALID_CHAIN)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue