From: Cristy Date: Wed, 7 Mar 2018 01:32:58 +0000 (-0500) Subject: Fix possible out of bounds issue X-Git-Tag: 7.0.7-26~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69c4513a4fb5f71421a21643edb53de53d3864a6;p=imagemagick Fix possible out of bounds issue --- diff --git a/MagickCore/fx.c b/MagickCore/fx.c index 583a478df..52b206da8 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -2372,7 +2372,8 @@ static double FxEvaluateSubexpression(FxInfo *fx_info, (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "ParenthesisNestedTooDeeply","`%s'",expression); (void) CopyMagickString(subexpression,expression+1,MagickPathExtent); - subexpression[strlen(subexpression)-1]='\0'; + if (strlen(subexpression) != 0) + subexpression[strlen(subexpression)-1]='\0'; gamma=FxEvaluateSubexpression(fx_info,channel,x,y,subexpression,depth, beta,exception); (*depth)--;