mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
avcodec/mpeg4videoenc: Check extradata malloc()
Fixes: Null pointer dereference Fixes: any mpeg4 testcase which fails the malloc at that exact spot Found-by: Rafael Dutra <rafael.dutra@cispa.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 33a1687bf623cdd5c6ffe8f63024d22ed20b4ead) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
36ee2ff37a
commit
5c3e640624
@ -1306,6 +1306,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
|
||||
if (s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
|
||||
s->avctx->extradata = av_malloc(1024);
|
||||
if (!s->avctx->extradata)
|
||||
return AVERROR(ENOMEM);
|
||||
init_put_bits(&s->pb, s->avctx->extradata, 1024);
|
||||
|
||||
if (!(s->workaround_bugs & FF_BUG_MS))
|
||||
|
Loading…
x
Reference in New Issue
Block a user