From 2f6ec9fdd7808c8ed045ae0ca4134ab21fb785e6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 7 Dec 2012 00:42:44 +0100 Subject: [PATCH] diracdec: Test mctmp and mcscratch for malloc failure. Fixes null pointer dereference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/diracdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index ef75a536ed..0ee16313af 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -353,7 +353,7 @@ static int alloc_sequence_buffers(DiracContext *s) s->mctmp = av_malloc((w+64+MAX_BLOCKSIZE) * (h*MAX_BLOCKSIZE) * sizeof(*s->mctmp)); s->mcscratch = av_malloc((w+64)*MAX_BLOCKSIZE); - if (!s->sbsplit || !s->blmotion) + if (!s->sbsplit || !s->blmotion || !s->mctmp || !s->mcscratch) return AVERROR(ENOMEM); return 0; }