[FFmpeg-cvslog] diracdec: Test mctmp and mcscratch for malloc failure.

Michael Niedermayer git at videolan.org
Fri Dec 7 02:25:03 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Dec  7 00:42:44 2012 +0100| [2f6ec9fdd7808c8ed045ae0ca4134ab21fb785e6] | committer: Michael Niedermayer

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 <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f6ec9fdd7808c8ed045ae0ca4134ab21fb785e6
---

 libavcodec/diracdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index ef75a53..0ee1631 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;
 }



More information about the ffmpeg-cvslog mailing list