From 8f6f8e4ac2cc22dd2bac60875c19425bd4284bd4 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Thu, 28 Apr 2022 11:36:46 -0400 Subject: [PATCH] roots: make sure we can never get a uint_max transid If we iterate over all roots to find the max transid, but the set of all roots is empty, we'll get a nonsense number. Make sure that number doesn't reach the crawling logic by killing it with an exception. Signed-off-by: Zygo Blaxell --- src/bees-roots.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bees-roots.cc b/src/bees-roots.cc index 0625d19..98199fa 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -229,6 +229,8 @@ BeesRoots::transid_max_nocache() // transid must be greater than zero, or we did something very wrong THROW_CHECK1(runtime_error, rv, rv > 0); + // transid must be less than max, or we did something very wrong + THROW_CHECK1(runtime_error, rv, rv < numeric_limits::max()); return rv; }