mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Avoid integer overflow
Use g_malloc_n in gdk_cairo_set_source_pixbuf when allocating a large block of memory, to avoid integer overflow. Pointed out by Bert Massop in https://bugzilla.gnome.org/show_bug.cgi?id=703220
This commit is contained in:
parent
f0a8d11563
commit
894b1ae76a
@ -213,7 +213,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
format = CAIRO_FORMAT_ARGB32;
|
||||
|
||||
cairo_stride = cairo_format_stride_for_width (format, width);
|
||||
cairo_pixels = g_malloc (height * cairo_stride);
|
||||
cairo_pixels = g_malloc_n (height, cairo_stride);
|
||||
surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels,
|
||||
format,
|
||||
width, height, cairo_stride);
|
||||
|
Loading…
Reference in New Issue
Block a user