You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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>
This commit is contained in:
@@ -453,7 +453,9 @@ static av_cold int hnm_decode_init(AVCodecContext *avctx)
|
|||||||
hnm->buffer2 = av_mallocz(avctx->width * avctx->height);
|
hnm->buffer2 = av_mallocz(avctx->width * avctx->height);
|
||||||
hnm->processed = 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_log(avctx, AV_LOG_ERROR, "av_mallocz() failed\n");
|
||||||
av_freep(&hnm->buffer1);
|
av_freep(&hnm->buffer1);
|
||||||
av_freep(&hnm->buffer2);
|
av_freep(&hnm->buffer2);
|
||||||
|
Reference in New Issue
Block a user