From 337b11c3b483e51c35266c0790ef12e8ac1a0e94 Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 2 Feb 2018 10:46:08 -0500 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5638 --- MagickCore/token.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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++; -- 2.40.0