[gegl] bin: pad blit buffers to avoid crashes



commit d9cd29ebfbdf9c5fde725bd7f1a1d7b7615affb1
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Jan 16 05:14:20 2019 +0100

    bin: pad blit buffers to avoid crashes

 bin/mrg-gegl.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/bin/mrg-gegl.c b/bin/mrg-gegl.c
index 70ab346ea..2e7267831 100644
--- a/bin/mrg-gegl.c
+++ b/bin/mrg-gegl.c
@@ -132,7 +132,11 @@ void mrg_gegl_buffer_blit (Mrg *mrg,
   {
     if (copy_buf)
       free (copy_buf);
-    copy_buf_len = width * height * 4;
+
+    /* we over-allocate ones scanline, otherwise we sometimes get
+       crashes.
+     */
+    copy_buf_len = width * (height+1) * 4;
     copy_buf = malloc (copy_buf_len);
   }
   {
@@ -234,7 +238,12 @@ void mrg_gegl_blit (Mrg *mrg,
   {
     if (copy_buf)
       free (copy_buf);
-    copy_buf_len = width * height * 4;
+
+    /* XXX: same overallocation as in other code-path, overallocating a fixed
+            amount might also be a sufficient workaround until the underlying
+            issue is resolved.
+     */
+    copy_buf_len = width * (height+1) * 4;
     copy_buf = malloc (copy_buf_len);
   }
   {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]