From: Chris Young Date: Sat, 5 Jan 2013 21:11:31 +0000 (+0000) Subject: Explicitly check if r0 or r1 are NaN, as if they are, on x86 the function evaluates... X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=3d74422216e1513bf651352a130ad49b9605bbf2;p=libsvgtiny.git Explicitly check if r0 or r1 are NaN, as if they are, on x86 the function evaluates as 0 (which is already handled), but on PPC the function evaluates to a negative value, causing the following for loop to become infinite. --- diff --git a/src/svgtiny_gradient.c b/src/svgtiny_gradient.c index 002c322..e330024 100644 --- a/src/svgtiny_gradient.c +++ b/src/svgtiny_gradient.c @@ -462,7 +462,13 @@ svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n, gradient_norm_squared; /* determine steps from change in r */ - steps = ceilf(fabsf(r1 - r0) / 0.05); + + if(isnan(r0) || isnan(r1)) { + steps = 1; + } else { + steps = ceilf(fabsf(r1 - r0) / 0.05); + } + if (steps == 0) steps = 1; fprintf(stderr, "r0 %g, r1 %g, steps %i\n",