From 0eccd3556a8c456239a49f9064381ddc3e28476e Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 17 Apr 2021 09:33:44 -0400 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33350 --- coders/map.c | 2 +- magick/draw.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/coders/map.c b/coders/map.c index 901f250d9a..097ce547d8 100644 --- a/coders/map.c +++ b/coders/map.c @@ -167,7 +167,7 @@ static Image *ReadMAPImage(const ImageInfo *image_info,ExceptionInfo *exception) packet_size=(size_t) (depth/8); pixels=(unsigned char *) AcquireQuantumMemory(image->columns,packet_size* sizeof(*pixels)); - packet_size=(size_t) (image->colors > 256 ? 6UL : 3UL); + packet_size=(size_t) (depth > 8 ? 6UL : 3UL); colormap=(unsigned char *) AcquireQuantumMemory(image->colors,packet_size* sizeof(*colormap)); if ((pixels == (unsigned char *) NULL) || diff --git a/magick/draw.c b/magick/draw.c index 67740ddd77..1f75220ffb 100644 --- a/magick/draw.c +++ b/magick/draw.c @@ -5454,16 +5454,17 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, (void) CopyMagickString(clone_info->filename,primitive_info->text, MagickPathExtent); status&=SetImageInfo(clone_info,0,exception); - if ((LocaleNCompare(clone_info->magick,"http",4) == 0) || - (LocaleCompare(clone_info->magick,"mpri") == 0) || - (LocaleCompare(clone_info->magick,"*") == 0)) - (void) CopyMagickString(clone_info->filename,primitive_info->text, - MagickPathExtent); + (void) CopyMagickString(clone_info->filename,primitive_info->text, + MagickPathExtent); if (clone_info->size != (char *) NULL) clone_info->size=DestroyString(clone_info->size); if (clone_info->extract != (char *) NULL) clone_info->extract=DestroyString(clone_info->extract); - if (*clone_info->filename != '\0') + if ((LocaleCompare(clone_info->magick,"file") == 0) || + (LocaleCompare(clone_info->magick,"https") == 0) || + (LocaleCompare(clone_info->magick,"http") == 0) || + (LocaleCompare(clone_info->magick,"mpri") == 0) || + (IsPathAccessible(clone_info->filename) != MagickFalse)) composite_images=ReadImage(clone_info,exception); } clone_info=DestroyImageInfo(clone_info);