gecko-dev/gfx/cairo/14-image-surface-oob-read.patch
Jonathan Kew 64df3d06dc Bug 1803059 - Remove obsolete patch files from gfx/cairo, and create patch files to record locally-applied fixes. r=gfx-reviewers,lsalzman DONTBUILD
When we did the major cairo update in bug 739096, most of our old patch files were superseded
and no longer relevant, but I failed to clean them up at the time. So here, we remove all the
old patch files, and create new ones just for the fixes we've applied on top of the new code
from upstream.

I've omitted patch files for fixes that I am aware have already landed upstream, as those will
automatically be included in any future update we take. (It's possible more of the new patch
files will also be obsolete by the time we try pulling a new version, but at least they should
provide a starting point.)

Differential Revision: https://phabricator.services.mozilla.com/D164680
2022-12-14 16:18:01 +00:00

18 lines
820 B
Diff

diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
+++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
@@ -873,8 +873,12 @@ static cairo_status_t
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
+ // The last row of data may have less than stride bytes so make sure we
+ // only copy the minimum amount required from that row.
memcpy (image_data, image_surface->data,
- image_surface->height * image_surface->stride);
+ (image_surface->height - 1) * image_surface->stride +
+ cairo_format_stride_for_width (image_surface->format,
+ image_surface->width));
*image_out = CairoQuartzCreateCGImage (image_surface->format,
image_surface->width,
image_surface->height,