From b41bd64e6956f77a1d37474f0cac1aab612a72d1 Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Thu, 20 Feb 2020 21:49:15 +0100 Subject: [PATCH] Handle hypothetical object size greater than 2^32B. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hypopg_relation_size wasn't careful when converting the number of blocks to bytes, as the result can overflow an int32. Per report from Jan Koßmann. --- CONTRIBUTORS.md | 1 + hypopg_index.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 4424eed..8428aa7 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -12,3 +12,4 @@ People who contributed to hypopg: * Joel Van Horn * Michael Lroll * Godwottery + * Jan Koßmann diff --git a/hypopg_index.c b/hypopg_index.c index a1c31c3..63da080 100644 --- a/hypopg_index.c +++ b/hypopg_index.c @@ -1500,7 +1500,7 @@ hypopg_relation_size(PG_FUNCTION_ARGS) } } - PG_RETURN_INT64(pages * BLCKSZ); + PG_RETURN_INT64(pages * 1.0L * BLCKSZ); } /*