[gdk-pixbuf/gdk-pixbuf-2-40] Check the memset length argument
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf/gdk-pixbuf-2-40] Check the memset length argument
- Date: Tue, 14 Jul 2020 02:35:33 +0000 (UTC)
commit 43ec8f286e3d499d82735c16bbca83d7a1c03efa
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Apr 1 18:11:55 2020 +0100
Check the memset length argument
Avoid overflows by using the checked multiplication macro for gsize.
Fixes: #132
gdk-pixbuf/io-gif-animation.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gdk-pixbuf/io-gif-animation.c b/gdk-pixbuf/io-gif-animation.c
index a3155e065..d74296337 100644
--- a/gdk-pixbuf/io-gif-animation.c
+++ b/gdk-pixbuf/io-gif-animation.c
@@ -411,11 +411,15 @@ gdk_pixbuf_gif_anim_iter_get_pixbuf (GdkPixbufAnimationIter *anim_iter)
/* If no rendered frame, render the first frame */
if (anim->last_frame == NULL) {
+ gsize len = 0;
if (anim->last_frame_data == NULL)
anim->last_frame_data = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, anim->width,
anim->height);
if (anim->last_frame_data == NULL)
return NULL;
- memset (gdk_pixbuf_get_pixels (anim->last_frame_data), 0, gdk_pixbuf_get_rowstride
(anim->last_frame_data) * anim->height);
+ if (g_size_checked_mul (&len, gdk_pixbuf_get_rowstride (anim->last_frame_data),
anim->height))
+ memset (gdk_pixbuf_get_pixels (anim->last_frame_data), 0, len);
+ else
+ return NULL;
composite_frame (anim, g_list_nth_data (anim->frames, 0));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]