[FFmpeg-devel] [PATCH] avcodec/vp6: Check alpha_context for allocation failures

Steven Liu lq at chinaffmpeg.org
Fri Feb 11 14:51:55 EET 2022


Fixes: null pointer dereference

Reported-by: TOTE Robot <oslab at tsinghua.edu.cn>
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavcodec/vp6.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index d024370793..7ddabbff80 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -653,6 +653,8 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx)
 
     if (s->has_alpha) {
         s->alpha_context = av_mallocz(sizeof(VP56Context));
+        if (!s->alpha_context)
+            return AVERROR(ENOMEM);
         ff_vp56_init_context(avctx, s->alpha_context,
                              s->flip == -1, s->has_alpha);
         ff_vp6dsp_init(&s->alpha_context->vp56dsp);
-- 
2.25.0



More information about the ffmpeg-devel mailing list