From 4eba69c305ce5a1efc0c5706c676dd3c46ae4d98 Mon Sep 17 00:00:00 2001 From: Bennett Date: Mon, 2 May 2022 17:25:23 -0700 Subject: [PATCH] Return timestamp of 0 if 'time' is NaN; would otherwise cause signed integer overflow in qRound64 --- app/common/timecodefunctions.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/common/timecodefunctions.cpp b/app/common/timecodefunctions.cpp index b80f8b237..2ac854af2 100644 --- a/app/common/timecodefunctions.cpp +++ b/app/common/timecodefunctions.cpp @@ -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: