[FFmpeg-devel] [PATCH 4/5] avcodec/ansi: Check nb_args for overflow
Michael Niedermayer
michael at niedermayer.cc
Sat Sep 19 22:31:08 EEST 2020
Fixes: Integer overflow (no testcase)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/ansi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 516d07db69..272185230d 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -431,7 +431,8 @@ static int decode_frame(AVCodecContext *avctx,
s->args[s->nb_args] = FFMAX(s->args[s->nb_args], 0) * 10 + buf[0] - '0';
break;
case ';':
- s->nb_args++;
+ if (s->nb_args < MAX_NB_ARGS)
+ s->nb_args++;
if (s->nb_args < MAX_NB_ARGS)
s->args[s->nb_args] = 0;
break;
--
2.17.1
More information about the ffmpeg-devel
mailing list