From: Cristy Date: Fri, 2 Feb 2018 15:46:08 +0000 (-0500) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5638 X-Git-Tag: 7.0.7-23~189 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=337b11c3b483e51c35266c0790ef12e8ac1a0e94;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5638 --- diff --git a/MagickCore/token.c b/MagickCore/token.c index 2f1bf4c53..cef1c00a8 100644 --- a/MagickCore/token.c +++ b/MagickCore/token.c @@ -309,8 +309,11 @@ MagickExport void GetNextToken(const char *start,const char **end, if (token[offset] == '#') offset++; i=(ssize_t) strlen(token); - (void) CopyMagickString(token,token+offset,MagickPathExtent); - token[i-offset-1]='\0'; + if (i > offset) + { + (void) CopyMagickString(token,token+offset,MagickPathExtent); + token[i-offset-1]='\0'; + } } while (isspace((int) ((unsigned char) *p)) != 0) p++;