Bug 795385 - Segmentation fault when using gradient tool

Make sure that the gradient cache in GimpOperationBlend contains
at least one pixel (is never NULL).
This commit is contained in:
Michael Natterer 2018-04-20 10:21:43 +02:00
parent ee7554678e
commit c0bac871ca
1 changed files with 3 additions and 0 deletions

View File

@ -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);