Browse Source

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>
tags/n4.4
Michael Niedermayer 4 years ago
parent
commit
33a1687bf6
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      libavcodec/mpeg4videoenc.c

+ 2
- 0
libavcodec/mpeg4videoenc.c View File

@@ -1304,6 +1304,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…
Cancel
Save