Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-11-16 02:33:49 +0400
committerAnton Khirnov <anton@khirnov.net>2011-11-19 13:22:27 +0400
commitd6f763659c6115e91d2fa981faffdb041d93f7a4 (patch)
tree0f8a94bfadb0ba493f8490102ab5ceb57183db6a
parente297459eb694490c25acc65bcf75ee1630bd34b6 (diff)
lavf: fix multiplication overflow in avformat_find_stream_info()
Converting to double before the multiplication rather than after avoids an integer overflow in some cases. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit 52767d891c665ab1124fe4ce82d99b59673de7d2) Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavformat/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d155599058..aa3ca5990b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2368,7 +2368,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
for (i=1; i<FF_ARRAY_ELEMS(st->info->duration_error); i++) {
int framerate= get_std_framerate(i);
int ticks= lrintf(dur*framerate/(1001*12));
- double error= dur - ticks*1001*12/(double)framerate;
+ double error = dur - (double)ticks*1001*12 / framerate;
st->info->duration_error[i] += error*error;
}
st->info->duration_count++;