summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-11-15 22:33:49 +0000
committerMans Rullgard <mans@mansr.com>2011-11-15 23:41:04 +0000
commit52767d891c665ab1124fe4ce82d99b59673de7d2 (patch)
treed1ae8e5cc0e861517d195522fdf51348bba3869d
parentf1d1516e5523db43776a364007cc4e0da8a6de58 (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>
-rw-r--r--libavformat/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2dc7623dff..11cb4f8b8e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2409,7 +2409,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++;