[gimp] Bug 795385 - Segmentation fault when using gradient tool



commit c0bac871ca4b3ccd9e7229bc74f177484b1ac0b3
Author: Michael Natterer <mitch gimp org>
Date:   Fri Apr 20 10:21:43 2018 +0200

    Bug 795385 - Segmentation fault when using gradient tool
    
    Make sure that the gradient cache in GimpOperationBlend contains
    at least one pixel (is never NULL).

 app/operations/gimpoperationgradient.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/app/operations/gimpoperationgradient.c b/app/operations/gimpoperationgradient.c
index 868591e..f14f030 100644
--- a/app/operations/gimpoperationgradient.c
+++ b/app/operations/gimpoperationgradient.c
@@ -1004,6 +1004,9 @@ gimp_operation_gradient_process (GeglOperation       *operation,
       cache_size = ceil (sqrt (SQR (self->start_x - self->end_x) +
                                SQR (self->start_y - self->end_y))) * 4;
 
+      /*  have at least one value in the cache  */
+      cache_size = MAX (cache_size, 1);
+
       if (cache_size != self->gradient_cache_size)
         {
           g_clear_pointer (&self->gradient_cache, g_free);


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