From 350f45378d0c10afdefd66f0b6ae5cad2378d4a2 Mon Sep 17 00:00:00 2001 From: Cristy Date: Tue, 27 Mar 2018 18:40:30 -0400 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7157 --- coders/heic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coders/heic.c b/coders/heic.c index 7e0f7cc0c..f8f337b93 100644 --- a/coders/heic.c +++ b/coders/heic.c @@ -686,8 +686,10 @@ static MagickBooleanType ParseAtom(Image *image, DataBuffer *db, case ATOM('i', 'd', 'a', 't'): { ctx->idatSize = atom_size - 8; + if (ctx->idat != (uint8_t *) NULL) + ctx->idat = (uint8_t *) RelinquishMagickMemory(ctx->idat); ctx->idat = (uint8_t *) AcquireMagickMemory(ctx->idatSize); - if (ctx->idat == NULL) + if (ctx->idat == (uint8_t *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); -- 2.40.0