From ecb40901a04e59821eca645ea89bdcfdd65e79f1 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Fri, 13 Apr 2018 01:30:25 +0200 Subject: [PATCH] Added check to prevent use of uninitialized value (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7585). --- coders/xpm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coders/xpm.c b/coders/xpm.c index 570cc3dbc..a3f583b47 100644 --- a/coders/xpm.c +++ b/coders/xpm.c @@ -387,7 +387,9 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception) Parse color. */ (void) CopyMagickString(target,"gray",MagickPathExtent); - q=ParseXPMColor(p+width,MagickTrue); + q=(char *) NULL; + if (strlen(p) > width) + q=ParseXPMColor(p+width,MagickTrue); if (q != (char *) NULL) { while ((isspace((int) ((unsigned char) *q)) == 0) && (*q != '\0')) -- 2.40.0