From d576fc8ca9a94ed7b48d8cfc0ccd71b52b63f924 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 13 Feb 2021 21:57:30 -0700 Subject: [PATCH] libtemporal: when computing Beats from a ticks value, do not try to pass potentially overflowing ticks value --- libs/temporal/temporal/beats.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/temporal/temporal/beats.h b/libs/temporal/temporal/beats.h index f031c36711..80c26593eb 100644 --- a/libs/temporal/temporal/beats.h +++ b/libs/temporal/temporal/beats.h @@ -119,8 +119,9 @@ public: } /** Create from ticks at the standard PPQN. */ - static Beats ticks(int32_t ticks) { - return Beats(0, ticks); + static Beats ticks(int64_t ticks) { + assert (ticks/PPQN < std::numeric_limits::max()); + return Beats (ticks / PPQN, ticks % PPQN); } /** Create from ticks at a given rate.