зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1778158 - quartz: Avoid reading beyond the end of image surfaces. r=jfkthame
The last row of data may have less than stride bytes so make sure we only copy what we need. This corresponds to cairo:cccc81ccba99600483621e02ae9438a4a5a3d024 Differential Revision: https://phabricator.services.mozilla.com/D151053
This commit is contained in:
Родитель
42807f13f3
Коммит
d9dcf5b2b6
|
@ -873,8 +873,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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче