aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-17 20:49:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-05 03:06:10 +0100
commit9085cdd677996fe792eef13bcbc670bf250e302b (patch)
tree9131ca0042dcfeaabbeb36a1b3d849212db0d7e1
parentab31a9ee4af5cfc0bab6b318512819fb706d0ff2 (diff)
downloadffmpeg-9085cdd677996fe792eef13bcbc670bf250e302b.tar.gz
avcodec/ansi: fix integer overflow
Fixes out of array read Fixes: 5f9698e86d92f19bb08d54ff0d57027f-signal_sigsegv_b30756_3795_cov_2693691257_ansi256.ans Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit d42ec8433c687fcbccefa51a7716d81920218e4f) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/ansi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index bd28a77be9..df04f091b9 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -419,7 +419,7 @@ static int decode_frame(AVCodecContext *avctx,
switch(buf[0]) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- if (s->nb_args < MAX_NB_ARGS)
+ if (s->nb_args < MAX_NB_ARGS && s->args[s->nb_args] < 6553)
s->args[s->nb_args] = FFMAX(s->args[s->nb_args], 0) * 10 + buf[0] - '0';
break;
case ';':