[FFmpeg-cvslog] avcodec/ansi: Check nb_args for overflow

Michael Niedermayer git at videolan.org
Sun Sep 20 19:04:28 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Sep 19 20:48:38 2020 +0200| [bc0e776c9aaf06f437bf21e05a713fd54dc85400] | committer: Michael Niedermayer

avcodec/ansi: Check nb_args for overflow

Fixes: Integer overflow (no testcase)

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc0e776c9aaf06f437bf21e05a713fd54dc85400
---

 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;



More information about the ffmpeg-cvslog mailing list