From 0bc26cac21f41ac6efd9d7e2373da5c39d901b30 Mon Sep 17 00:00:00 2001 From: Jakob Blomer Date: Thu, 14 Nov 2024 23:21:05 +0100 Subject: [PATCH] [ntuple] add assert()s in RPage(Pool) logic --- tree/ntuple/v7/inc/ROOT/RPage.hxx | 2 ++ tree/ntuple/v7/src/RPagePool.cxx | 1 + 2 files changed, 3 insertions(+) diff --git a/tree/ntuple/v7/inc/ROOT/RPage.hxx b/tree/ntuple/v7/inc/ROOT/RPage.hxx index a9def8ff11d60..676369fd60f8f 100644 --- a/tree/ntuple/v7/inc/ROOT/RPage.hxx +++ b/tree/ntuple/v7/inc/ROOT/RPage.hxx @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -152,6 +153,7 @@ public: /// return value is ignored. void *GrowUnchecked(ClusterSize_t::ValueType nElements) { + assert(fNElements + nElements <= fMaxElements); auto offset = GetNBytes(); fNElements += nElements; return static_cast(fBuffer) + offset; diff --git a/tree/ntuple/v7/src/RPagePool.cxx b/tree/ntuple/v7/src/RPagePool.cxx index 6e9f072bc12bc..160a3f78a7d21 100644 --- a/tree/ntuple/v7/src/RPagePool.cxx +++ b/tree/ntuple/v7/src/RPagePool.cxx @@ -55,6 +55,7 @@ void ROOT::Experimental::Internal::RPagePool::ReleasePage(const RPage &page) const auto idx = itrLookup->second; const auto N = fEntries.size(); + assert(fEntries[idx].fRefCounter >= 1); if (--fEntries[idx].fRefCounter == 0) { fLookupByBuffer.erase(itrLookup);