Message ID | 20210319160431.3378-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 33a1687bf623cdd5c6ffe8f63024d22ed20b4ead |
Headers | show |
Series | [FFmpeg-devel] avcodec/mpeg4videoenc: Check extradata malloc() | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Fri, Mar 19, 2021 at 05:04:31PM +0100, Michael Niedermayer wrote: > 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> > --- > libavcodec/mpeg4videoenc.c | 2 ++ > 1 file changed, 2 insertions(+) will apply [...]
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))
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> --- libavcodec/mpeg4videoenc.c | 2 ++ 1 file changed, 2 insertions(+)