avformat/bintext: protect against potential overflow of chars_per_frame
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 21 Oct 2013 21:19:04 +0000 (23:19 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 21 Oct 2013 21:37:49 +0000 (23:37 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/bintext.c

index d504607..d50a8d9 100644 (file)
@@ -65,7 +65,7 @@ static AVStream * init_stream(AVFormatContext *s)
     avpriv_set_pts_info(st, 60, bin->framerate.den, bin->framerate.num);
 
     /* simulate tty display speed */
-    bin->chars_per_frame = FFMAX(av_q2d(st->time_base) * bin->chars_per_frame, 1);
+    bin->chars_per_frame = av_clip(av_q2d(st->time_base) * bin->chars_per_frame, 1, INT_MAX);
 
     return st;
 }