aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-09-19 20:48:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commitbc50487b63c4b615b841957ba2ebb84b238a6152 (patch)
treec8725f8851af891b515ca1bfc0823450abd327a9
parent7f7496f6dc3eab564145c9e4918eb6b79eba886d (diff)
downloadffmpeg-bc50487b63c4b615b841957ba2ebb84b238a6152.tar.gz
avcodec/ansi: Check nb_args for overflow
Fixes: Integer overflow (no testcase) Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit bc0e776c9aaf06f437bf21e05a713fd54dc85400) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ansi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 31405b4a99..2935047590 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -430,7 +430,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;