[FFmpeg-cvslog] update_stream_timings: check bitrate for being in range.

Michael Niedermayer git at videolan.org
Mon Mar 4 18:59:54 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Mar  4 18:54:00 2013 +0100| [7992bdbeb4ba72a9d28e72acc2b3bc0d198401ec] | committer: Michael Niedermayer

update_stream_timings: check bitrate for being in range.

Fixes numerical overflow
Fixes Ticket2089

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/utils.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 724cc05..f71184f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2230,8 +2230,10 @@ static void update_stream_timings(AVFormatContext *ic)
     }
         if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration != AV_NOPTS_VALUE) {
             /* compute the bitrate */
-            ic->bit_rate = (double)filesize * 8.0 * AV_TIME_BASE /
+            double bitrate = (double)filesize * 8.0 * AV_TIME_BASE /
                 (double)ic->duration;
+            if (bitrate >= 0 && bitrate <= INT_MAX)
+                ic->bit_rate = bitrate;
         }
 }
 



More information about the ffmpeg-cvslog mailing list