1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/mjpegdec: use mallocz for progressive blocks

Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f849c599487_6828_mjpeg.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-12-13 20:25:38 +01:00
parent 7d7a701362
commit 0c23ee1312

View File

@ -510,7 +510,7 @@ unk_pixfmt:
int size = bw * bh * s->h_count[i] * s->v_count[i];
av_freep(&s->blocks[i]);
av_freep(&s->last_nnz[i]);
s->blocks[i] = av_malloc(size * sizeof(**s->blocks));
s->blocks[i] = av_mallocz(size * sizeof(**s->blocks));
s->last_nnz[i] = av_mallocz(size * sizeof(**s->last_nnz));
if (!s->blocks[i] || !s->last_nnz[i])
return AVERROR(ENOMEM);