From: Cristy Date: Sat, 27 Jan 2018 16:52:58 +0000 (-0500) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5545 X-Git-Tag: 7.0.7-23~262 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0dc17e69f21248df319c49e22a589043fa69da7;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5545 --- diff --git a/coders/mat.c b/coders/mat.c index 1fe03e5d8..312b1c125 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -602,7 +602,7 @@ static Image *ReadMATImageV4(const ImageInfo *image_info,Image *image, endian; Image - *rotate_image; + *rotated_image; MagickBooleanType status; @@ -783,11 +783,21 @@ static Image *ReadMATImageV4(const ImageInfo *image_info,Image *image, image->filename); break; } - rotate_image=RotateImage(image,90.0,exception); - if (rotate_image != (Image *) NULL) + rotated_image=RotateImage(image,90.0,exception); + if (rotated_image != (Image *) NULL) { - image=DestroyImage(image); - image=rotate_image; + void + *blob; + + rotated_image->page.x=0; + rotated_image->page.y=0; + blob = rotated_image->blob; + rotated_image->blob = image->blob; + rotated_image->colors = image->colors; + image->blob = blob; + AppendImageToList(&image,rotated_image); + DeleteImageFromList(&image->previous); + image = rotated_image; } /* Proceed to next image.