From 20cb1a0a1a96b1c28fc6c444cae18c95c1465b74 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Mon, 3 Jan 2022 19:50:15 +0100 Subject: [PATCH] Fix overflow when calculating max allowed size of memory (4Gb) --- lib/fizzy/limits.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fizzy/limits.hpp b/lib/fizzy/limits.hpp index f0d19851d..a16cacb75 100644 --- a/lib/fizzy/limits.hpp +++ b/lib/fizzy/limits.hpp @@ -14,7 +14,7 @@ constexpr uint32_t PageSize = 65536; /// Convert memory size in pages to size in bytes. inline constexpr uint64_t memory_pages_to_bytes(uint32_t pages) noexcept { - return pages * PageSize; + return uint64_t{pages} * PageSize; } /// The maximum memory page limit as defined by the specification.