From: Cristy Date: Sat, 24 Feb 2018 14:35:38 +0000 (-0500) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6535 X-Git-Tag: 7.0.7-24~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e79350c54735fd1051bd0b153ef277a13a7b9618;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6535 --- diff --git a/coders/dcm.c b/coders/dcm.c index 1f66bba66..00d730485 100644 --- a/coders/dcm.c +++ b/coders/dcm.c @@ -3972,7 +3972,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) for (i=0; i < (ssize_t) colors; i++) { index=redmap[i]; - if ((info.scale != (Quantum *) NULL) && + if ((info.scale != (Quantum *) NULL) && (index >= 0) && (index <= (int) info.max_value)) index=(int) info.scale[index]; image->colormap[i].red=(MagickRealType) index; @@ -3981,7 +3981,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) for (i=0; i < (ssize_t) colors; i++) { index=greenmap[i]; - if ((info.scale != (Quantum *) NULL) && + if ((info.scale != (Quantum *) NULL) && (index >= 0) && (index <= (int) info.max_value)) index=(int) info.scale[index]; image->colormap[i].green=(MagickRealType) index; @@ -3990,7 +3990,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) for (i=0; i < (ssize_t) colors; i++) { index=bluemap[i]; - if ((info.scale != (Quantum *) NULL) && + if ((info.scale != (Quantum *) NULL) && (index >= 0) && (index <= (int) info.max_value)) index=(int) info.scale[index]; image->colormap[i].blue=(MagickRealType) index; @@ -3999,7 +3999,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) for (i=0; i < (ssize_t) colors; i++) { index=graymap[i]; - if ((info.scale != (Quantum *) NULL) && + if ((info.scale != (Quantum *) NULL) && (index >= 0) && (index <= (int) info.max_value)) index=(int) info.scale[index]; image->colormap[i].red=(MagickRealType) index;