[gdk-pixbuf] Revert "pixdata: Prevent buffer overflow by checking for bounds before memcpy"
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] Revert "pixdata: Prevent buffer overflow by checking for bounds before memcpy"
- Date: Fri, 16 Dec 2016 15:38:40 +0000 (UTC)
commit 6ddb1600e28d283ef953fd647bb5e3eca284bc69
Author: Bastien Nocera <hadess hadess net>
Date: Fri Dec 16 13:57:35 2016 +0100
Revert "pixdata: Prevent buffer overflow by checking for bounds before memcpy"
The fix is incorrect.
This reverts commit 9ae4723ec3fa631354e3d201c5435a7385c33d45.
https://bugzilla.gnome.org/show_bug.cgi?id=775693
gdk-pixbuf/gdk-pixdata.c | 19 +------------------
1 files changed, 1 insertions(+), 18 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixdata.c b/gdk-pixbuf/gdk-pixdata.c
index 5cf485c..b026f7d 100644
--- a/gdk-pixbuf/gdk-pixdata.c
+++ b/gdk-pixbuf/gdk-pixdata.c
@@ -430,7 +430,6 @@ gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
{
guint encoding, bpp;
guint8 *data = NULL;
- guint8 *data_limit = NULL;
g_return_val_if_fail (pixdata != NULL, NULL);
g_return_val_if_fail (pixdata->width > 0, NULL);
@@ -457,9 +456,6 @@ gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
if (copy_pixels)
{
data = g_try_malloc_n (pixdata->height, pixdata->rowstride);
- /* If this calculation overflows, data is NULL */
- const size_t data_size = pixdata->height * pixdata->rowstride;
- data_limit = data + data_size;
if (!data)
{
g_set_error (error, GDK_PIXBUF_ERROR,
@@ -526,20 +522,7 @@ gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
}
}
else if (copy_pixels)
- {
- if (data + (pixdata->rowstride * pixdata->height) < data_limit)
- {
- memcpy (data, pixdata->pixel_data, pixdata->rowstride * pixdata->height);
- }
- else
- {
- g_free (data);
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Image pixel data corrupt"));
- return NULL;
- }
- }
+ memcpy (data, pixdata->pixel_data, pixdata->rowstride * pixdata->height);
else
data = pixdata->pixel_data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]