aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-04 18:54:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-04 18:54:00 +0100
commit7992bdbeb4ba72a9d28e72acc2b3bc0d198401ec (patch)
treebd5d012ff8cc1b6d90d339f742b778044ad1742b
parentdae38a66ebd8a71aad51a29311f1c50df3ae3a2e (diff)
downloadffmpeg-7992bdbeb4ba72a9d28e72acc2b3bc0d198401ec.tar.gz
update_stream_timings: check bitrate for being in range.
Fixes numerical overflow Fixes Ticket2089 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 724cc05366..f71184f65e 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;
}
}