From 6242f40d4866a73e6616be6694a980158a7ce37c Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 15 Aug 2024 11:37:36 -0700 Subject: [PATCH] Require that eraseBetween leave at least one child or entryPresent --- ConflictSet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 46aa484..db74829 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -1922,7 +1922,9 @@ void eraseBetween(Node **inTree, Node256 *n, int begin, int end, } // Erase all nodes with a search path starting with n + [child], -// where child in [begin, end). +// where child in [begin, end). To avoid the need to propagate erases up the +// search path, the caller must ensure that the result has at least one child or +// has entryPresent. void eraseBetween(Node *&n, int begin, int end, WriteContext *tls) { #if DEBUG_VERBOSE && !defined(NDEBUG) fprintf(stderr, "eraseBetween: %s + [%d,%d)\n", @@ -1946,6 +1948,7 @@ void eraseBetween(Node *&n, int begin, int end, WriteContext *tls) { default: // GCOVR_EXCL_LINE __builtin_unreachable(); // GCOVR_EXCL_LINE } + assert(n->numChildren > 0 || n->entryPresent); } // Precondition: self is not the root. May invalidate nodes along the search