From: Cristy Date: Mon, 10 Aug 2015 23:15:07 +0000 (-0400) Subject: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=28179 X-Git-Tag: 7.0.1-0~708 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7b7991914d7f4ca1839585f4ea9dd7c13028bce;p=imagemagick http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=28179 --- diff --git a/MagickCore/fx.c b/MagickCore/fx.c index 37fd73ae2..d20680df0 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -2232,14 +2232,26 @@ static double FxEvaluateSubexpression(FxInfo *fx_info, } case LogicalAndOperator: { - gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,beta,exception); - *beta=(alpha > 0.0) && (gamma > 0.0) ? 1.0 : 0.0; + p++; + if (alpha <= 0.0) + { + *beta=0.0; + return(*beta); + } + gamma=FxEvaluateSubexpression(fx_info,channel,x,y,p,beta,exception); + *beta=(gamma > 0.0) ? 1.0 : 0.0; return(*beta); } case LogicalOrOperator: { - gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,beta,exception); - *beta=(alpha > 0.0) || (gamma > 0.0) ? 1.0 : 0.0; + p++; + if (alpha > 0.0) + { + *beta=1.0; + return(*beta); + } + gamma=FxEvaluateSubexpression(fx_info,channel,x,y,p,beta,exception); + *beta=(gamma > 0.0) ? 1.0 : 0.0; return(*beta); } case '?':