mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/mjpegdec: check for malloc failure of blocks[] and last_nnz[]
Fixes null pointer dereference Fixes Ticket2947 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
23bd0335af
commit
6c07e41f43
@ -507,6 +507,8 @@ unk_pixfmt:
|
|||||||
av_freep(&s->last_nnz[i]);
|
av_freep(&s->last_nnz[i]);
|
||||||
s->blocks[i] = av_malloc(size * sizeof(**s->blocks));
|
s->blocks[i] = av_malloc(size * sizeof(**s->blocks));
|
||||||
s->last_nnz[i] = av_mallocz(size * sizeof(**s->last_nnz));
|
s->last_nnz[i] = av_mallocz(size * sizeof(**s->last_nnz));
|
||||||
|
if (!s->blocks[i] || !s->last_nnz[i])
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
s->block_stride[i] = bw * s->h_count[i];
|
s->block_stride[i] = bw * s->h_count[i];
|
||||||
}
|
}
|
||||||
memset(s->coefs_finished, 0, sizeof(s->coefs_finished));
|
memset(s->coefs_finished, 0, sizeof(s->coefs_finished));
|
||||||
|
Loading…
Reference in New Issue
Block a user