summaryrefslogtreecommitdiff
path: root/libavcodec/ansi.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-09-19 20:48:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-09-20 18:03:52 +0200
commitbc0e776c9aaf06f437bf21e05a713fd54dc85400 (patch)
treec85a1a7739293becd603f87bcd9d138fd517d609 /libavcodec/ansi.c
parentb78860e769876d9a18fc4f82dd8e808316d8e682 (diff)
downloadffmpeg-bc0e776c9aaf06f437bf21e05a713fd54dc85400.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>
Diffstat (limited to 'libavcodec/ansi.c')
-rw-r--r--libavcodec/ansi.c3
1 files changed, 2 insertions, 1 deletions
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;