From c7b7991914d7f4ca1839585f4ea9dd7c13028bce Mon Sep 17 00:00:00 2001 From: Cristy Date: Mon, 10 Aug 2015 19:15:07 -0400 Subject: [PATCH] http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=28179 --- MagickCore/fx.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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 '?': -- 2.40.0