From b98b72f3c44400a047f40a258265648ed8a6e888 Mon Sep 17 00:00:00 2001
From: Philippe Canal <pcanal@fnal.gov>
Date: Fri, 3 Oct 2008 17:25:00 +0000
Subject: [PATCH] Avoid out-of-bound lookup inside GetListOfBaskets()

git-svn-id: http://root.cern.ch/svn/root/trunk@25698 27541ba8-7e3a-0410-8455-c3a389f83636
---
 tree/tree/src/TTreeCache.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tree/tree/src/TTreeCache.cxx b/tree/tree/src/TTreeCache.cxx
index 47f75cf75e0..85e5cb62eff 100644
--- a/tree/tree/src/TTreeCache.cxx
+++ b/tree/tree/src/TTreeCache.cxx
@@ -279,9 +279,10 @@ Bool_t TTreeCache::FillBuffer()
       if (!lbaskets || !entries) continue;
       //we have found the branch. We now register all its baskets
       //from the requested offset to the basket below fEntrymax
+      Int_t blistsize = b->GetListOfBaskets()->GetSize();
       for (Int_t j=0;j<nb;j++) {
          // This basket has already been read, skip it
-         if (b->GetListOfBaskets()->UncheckedAt(j)) continue;
+         if (j<blistsize && b->GetListOfBaskets()->UncheckedAt(j)) continue;
 
          Long64_t pos = b->GetBasketSeek(j);
          Int_t len = lbaskets[j];
-- 
GitLab