25-recording-surface-region-array-destroy.patch (1023B)
1 # HG changeset patch 2 # User Jonathan Kew <jkew@mozilla.com> 3 # Date 1716218236 -3600 4 # Mon May 20 16:17:16 2024 +0100 5 # Node ID 475bcd0d578be25a21dd8ffedea8f2622c49b226 6 # Parent d43c2db9336dae716a8b17ea53f72312fa14fb0b 7 Bug 1897561 - Avoid trying to access region elements that didn't get set up (in case of an error status on the surface). r=#gfx-reviewers 8 9 diff --git a/gfx/cairo/cairo/src/cairo-recording-surface.c b/gfx/cairo/cairo/src/cairo-recording-surface.c 10 --- a/gfx/cairo/cairo/src/cairo-recording-surface.c 11 +++ b/gfx/cairo/cairo/src/cairo-recording-surface.c 12 @@ -480,7 +480,7 @@ static void 13 cairo_recording_region_element_t *region_elements; 14 int i, num_elements; 15 16 - num_elements = surface->commands.num_elements; 17 + num_elements = MAX(surface->commands.num_elements, _cairo_array_num_elements(®ion_array->regions)); 18 elements = _cairo_array_index (&surface->commands, 0); 19 region_elements = _cairo_array_index (®ion_array->regions, 0); 20 for (i = 0; i < num_elements; i++) {