plug-ins: fix gradient-flare crash in Selector editor.

In the Selector editor dialog, on the Glow tab, Changing the Size (%)
and then sliding it back to 0, causes a crash when reaching 0.
When the Size is 0, the pos in `calc_get_gradient` is NAN, which we
do no check for.
This could be issue #13282, but until we hear back and see a crashlog,
we can't be sure.

There might be other issues earlier on, but the whole plug-in could
probably use a revision since a lot of code is unchanged from 1999.
So let's just add a check for `isnan` and additionally change the
< 0 check to < 0.0001, since I saw it not catching very small values
near zero.
This commit is contained in:
Jacob Boerema 2025-03-21 16:32:29 -04:00
parent a705e0fec3
commit 73341ebdbd
1 changed files with 1 additions and 1 deletions

View File

@ -2143,7 +2143,7 @@ calc_get_gradient (guchar *pix, guchar *gradient, gdouble pos)
gdouble frac;
gint i;
if (pos < 0 || pos > 1)
if (isnan (pos) || pos < 0.0001 || pos > 1)
{
pix[0] = pix[1] = pix[2] = pix[3] = 0;
return;