[gimp/gimp-2-10] app: avoid risky alloca() in gimp_brush_save()
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: avoid risky alloca() in gimp_brush_save()
- Date: Thu, 28 Mar 2019 20:56:22 +0000 (UTC)
commit c8ea2f45f9fe50ac2211b7bac4e24790720ab43a
Author: Ell <ell_se yahoo com>
Date: Thu Mar 28 16:52:08 2019 -0400
app: avoid risky alloca() in gimp_brush_save()
Replace an arbitrarily-sized g_alloca() with g_malloc() in
gimp_brush_save().
(cherry picked from commit 24ed9dbdf5414864103e3433ffd0c58995696ecb)
app/core/gimpbrush-save.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpbrush-save.c b/app/core/gimpbrush-save.c
index 53202507ef..38d4bcd92f 100644
--- a/app/core/gimpbrush-save.c
+++ b/app/core/gimpbrush-save.c
@@ -68,7 +68,7 @@ gimp_brush_save (GimpData *data,
if (pixmap)
{
gsize size = width * height * 4;
- guchar *data = g_alloca (size);
+ guchar *data = g_malloc (size);
guchar *p = gimp_temp_buf_get_data (pixmap);
guchar *m = gimp_temp_buf_get_data (mask);
guchar *d = data;
@@ -85,9 +85,13 @@ gimp_brush_save (GimpData *data,
if (! g_output_stream_write_all (output, data, size,
NULL, NULL, error))
{
+ g_free (data);
+
return FALSE;
}
- }
+
+ g_free (data);
+ }
else
{
if (! g_output_stream_write_all (output,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]