mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-03 16:20:17 +01:00
Merge branch 'quartz-memcpy' into 'master'
quartz: Avoid reading beyond the end of image surfaces. See merge request cairo/cairo!337
This commit is contained in:
commit
d64f9699eb
1 changed files with 5 additions and 1 deletions
|
|
@ -772,8 +772,12 @@ _cairo_surface_to_cgimage (cairo_surface_t *source,
|
|||
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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue