mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat/sbgdec: Reduce the amount of floating point in str_to_time()
Fixes: 1e+75 is outside the range of representable values of type 'long' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6626834808700928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d03c7b1ad4
commit
ac6c8993f7
@ -181,6 +181,7 @@ static int str_to_time(const char *str, int64_t *rtime)
|
||||
char *end;
|
||||
int hours, minutes;
|
||||
double seconds = 0;
|
||||
int64_t ts = 0;
|
||||
|
||||
if (*cur < '0' || *cur > '9')
|
||||
return 0;
|
||||
@ -196,8 +197,9 @@ static int str_to_time(const char *str, int64_t *rtime)
|
||||
seconds = strtod(cur + 1, &end);
|
||||
if (end > cur + 1)
|
||||
cur = end;
|
||||
ts = av_clipd(seconds * AV_TIME_BASE, INT64_MIN/2, INT64_MAX/2);
|
||||
}
|
||||
*rtime = (hours * 3600LL + minutes * 60LL + seconds) * AV_TIME_BASE;
|
||||
*rtime = (hours * 3600LL + minutes * 60LL) * AV_TIME_BASE + ts;
|
||||
return cur - str;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user