diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-22 23:11:20 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-22 23:52:08 +0100 |
commit | bd8d28e2d2713f0368ee6b7dbb5ec251cbc162ac (patch) | |
tree | 31215e2e07d6b4e44e0f4d061145df179447d519 /libavcodec/hnm4video.c | |
parent | 004f3b154b7c23662263f1ff118f69ff54e55013 (diff) | |
download | ffmpeg-bd8d28e2d2713f0368ee6b7dbb5ec251cbc162ac.tar.gz |
avcodec/hnm4video: check dimensions for validity
Fixes out of array read
Fixes: asan_heap-oob_e76e18_1244_CASSE.HNM
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hnm4video.c')
-rw-r--r-- | libavcodec/hnm4video.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/hnm4video.c b/libavcodec/hnm4video.c index 678d283d47..f394032288 100644 --- a/libavcodec/hnm4video.c +++ b/libavcodec/hnm4video.c @@ -453,7 +453,9 @@ static av_cold int hnm_decode_init(AVCodecContext *avctx) hnm->buffer2 = av_mallocz(avctx->width * avctx->height); hnm->processed = av_mallocz(avctx->width * avctx->height); - if (!hnm->buffer1 || !hnm->buffer2 || !hnm->processed) { + if ( !hnm->buffer1 || !hnm->buffer2 || !hnm->processed + || avctx->width * avctx->height == 0 + || avctx->height % 2) { av_log(avctx, AV_LOG_ERROR, "av_mallocz() failed\n"); av_freep(&hnm->buffer1); av_freep(&hnm->buffer2); |