aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-19 16:30:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-11 21:23:49 +0200
commit5c3e6406244201ba3886cf2d0df99b84a3411cd4 (patch)
tree6de85c14d6df041b87cad0161bccf825318a5734
parent36ee2ff37aa6c856e9f6d26136e4d00836076aa1 (diff)
downloadffmpeg-5c3e6406244201ba3886cf2d0df99b84a3411cd4.tar.gz
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>
-rw-r--r--libavcodec/mpeg4videoenc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 2cd5a8c015..2d9d6cd654 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -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))