Merge pull request #1909 from aeroc7/ub_fixes

Fix undefined behavior: return timestamp of 0 if 'time' is NaN
This commit is contained in:
itsmattkc
2022-05-03 15:52:33 -07:00
committed by GitHub
+5 -1
View File
@@ -287,7 +287,11 @@ int64_t Timecode::time_to_timestamp(const rational &time, const rational &timeba
int64_t Timecode::time_to_timestamp(const double &time, const rational &timebase, Rounding floor)
{
double d = time * timebase.flipped().toDouble();
const double d = time * timebase.flipped().toDouble();
if (std::isnan(d)) {
return 0;
}
switch (floor) {
case kRound: