aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg4videoenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-19 16:30:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit77cab29a285e66fae3adbbe2c1f55aa6325c825d (patch)
tree956a719a0f1b5d8ae071e1bd599d6474a52b5cad /libavcodec/mpeg4videoenc.c
parentb2d4f33fd42d177c38ff0b32683c9a1e6bd2c67e (diff)
downloadffmpeg-77cab29a285e66fae3adbbe2c1f55aa6325c825d.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>
Diffstat (limited to 'libavcodec/mpeg4videoenc.c')
-rw-r--r--libavcodec/mpeg4videoenc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 293be49aff..0c2533a72b 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1334,6 +1334,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))