History

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.

Mans Rullgard committed 15 years ago

Commit 52767d81 parent f1d15161 file · +1 −1Browse files

Unified · Split

libavformat/utils.c+1−1
@@ -2409,7 +2409,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) · 2408 unmodified lines
24092409 for (i=1; i<FF_ARRAY_ELEMS(st->info->duration_error); i++) {
24102410 int framerate= get_std_framerate(i);
24112411 int ticks= lrintf(dur*framerate/(1001*12));
2412− double error= dur - ticks*1001*12/(double)framerate;
2412+ double error = dur - (double)ticks*1001*12 / framerate;
24132413 st->info->duration_error[i] += error*error;
24142414 }
24152415 st->info->duration_count++;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t