summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristy <mikayla-grace@urban-warrior.org>2020-01-04 09:15:22 -0500
committerCristy <mikayla-grace@urban-warrior.org>2020-01-04 09:15:22 -0500
commitcd35745673de213b5367666e8801f606a667c444 (patch)
treef2cd46f092a090f464dabad4589c9dc3cc8aa1d6
parentf672634432b1fe5b5a0a1b26b1a8c64634a47246 (diff)
downloadImageMagick-cd35745673de213b5367666e8801f606a667c444.tar.gz
Fix memory leak for corrupt image file
-rw-r--r--coders/dcm.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/coders/dcm.c b/coders/dcm.c
index d2890d09a..f119a0998 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -3859,18 +3859,17 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
tag=((unsigned int) ReadBlobLSBShort(image) << 16) |
ReadBlobLSBShort(image);
length=(size_t) ReadBlobLSBLong(image);
- if (length > (size_t) GetBlobSize(image))
+ if (EOFBlob(image) != MagickFalse)
{
- read_info=DestroyImageInfo(read_info);
- ThrowDCMException(CorruptImageError,
- "InsufficientImageDataInFile");
+ status=MagickFalse;
+ break;
}
if (tag == 0xFFFEE0DD)
break; /* sequence delimiter tag */
if (tag != 0xFFFEE000)
{
- read_info=DestroyImageInfo(read_info);
- ThrowDCMException(CorruptImageError,"ImproperImageHeader");
+ status=MagickFalse;
+ break;
}
file=(FILE *) NULL;
unique_file=AcquireUniqueFileResource(filename);