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-03-20 00:36:09 +0100
commit33a1687bf623cdd5c6ffe8f63024d22ed20b4ead (patch)
tree8f28fa059e5469681a592a11623e79dae822d444 /libavcodec/mpeg4videoenc.c
parent92fde2585e98b83143e84fd2899148990f594c3f (diff)
downloadffmpeg-33a1687bf623cdd5c6ffe8f63024d22ed20b4ead.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>
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 a092ab01d0..a879d2fd18 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -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))