Fix theoretical int overflow.
authorCarl Hetherington <cth@carlh.net>
Sat, 28 Oct 2023 21:02:54 +0000 (23:02 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 28 Oct 2023 21:02:54 +0000 (23:02 +0200)
src/lib/dcpomatic_time.h

index 9e7191b1eb7dc239a890aebc2d6efa5fe81d3f75..1b12ea901653ead8afd3f935679eaea8ecf6e57a 100644 (file)
@@ -217,11 +217,11 @@ public:
                HMSF hmsf;
 
                hmsf.h = ff / (3600 * r);
-               ff -= hmsf.h * 3600 * r;
+               ff -= static_cast<int64_t>(hmsf.h) * 3600 * r;
                hmsf.m = ff / (60 * r);
-               ff -= hmsf.m * 60 * r;
+               ff -= static_cast<int64_t>(hmsf.m) * 60 * r;
                hmsf.s = ff / r;
-               ff -= hmsf.s * r;
+               ff -= static_cast<int64_t>(hmsf.s) * r;
 
                hmsf.f = static_cast<int> (ff);
                return hmsf;