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>
This commit is contained in:
parent
f1d1516e55
commit
52767d891c
@ -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++) {
|
for (i=1; i<FF_ARRAY_ELEMS(st->info->duration_error); i++) {
|
||||||
int framerate= get_std_framerate(i);
|
int framerate= get_std_framerate(i);
|
||||||
int ticks= lrintf(dur*framerate/(1001*12));
|
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_error[i] += error*error;
|
||||||
}
|
}
|
||||||
st->info->duration_count++;
|
st->info->duration_count++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user