-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugexperimentAffects an experiment / reported by its software & computimng expertsAffects an experiment / reported by its software & computimng expertsin:TTree
Description
Check duplicate issues.
- Checked for duplicates
Description
Equivalent of #20226, but for TTree::Draw. In this case it's slightly more difficult to trigger the integer overflow, albeit absolutely doable. a run of the reproducer shows an empty histogram, thus confirming that the overflow prevents the loop from even starting. This is due to (in the case nentries==TTree::kMaxEntries)
root/tree/treeplayer/src/TTreePlayer.cxx
Line 2294 in a1c112f
| for (entry=firstentry;entry<firstentry+nentries;entry++) { |
Guarded by this innocent-looking line
root/tree/treeplayer/src/TTreePlayer.cxx
Lines 429 to 430 in a1c112f
| // Do not process more than fMaxEntryLoop entries | |
| if (nentries > fTree->GetMaxEntryLoop()) nentries = fTree->GetMaxEntryLoop(); |
Reproducer
#include <TChain.h>
#include <TFile.h>
#include <TTree.h>
#include <memory>
#include <iostream>
void make_step_one_file(const char *name, const char *treename, int nEntries)
{
auto file = std::make_unique<TFile>(name, "RECREATE");
auto tree = std::make_unique<TTree>(treename, treename);
for (int i = 0; i < nEntries; ++i)
{
tree->Fill();
}
file->Write();
}
void make_step_zero_file(const char *name, const char *treename, int first, int last)
{
auto file = std::make_unique<TFile>(name, "RECREATE");
auto tree = std::make_unique<TTree>(treename, treename);
int index{};
int value{};
tree->Branch("index", &index);
tree->Branch("value", &value);
for (index = first; index < last; ++index)
{
value = 2 * index;
tree->Fill();
}
file->Write();
}
void ttree_scan_int_overflow()
{
make_step_zero_file("friends-hybrid-step0-0.root", "stepzerotree", 0, 10);
auto file = std::make_unique<TFile>("friends-hybrid-step0-0.root");
std::unique_ptr<TTree> tree{file->Get<TTree>("stepzerotree")};
tree->SetMaxEntryLoop(TTree::kMaxEntries);
std::cout << tree->Draw("index", "", "", TTree::kMaxEntries, 3) << "\n";
}
int main()
{
ttree_scan_int_overflow();
}ROOT version
Any
Installation method
Any
Operating system
Any
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugexperimentAffects an experiment / reported by its software & computimng expertsAffects an experiment / reported by its software & computimng expertsin:TTree
Type
Projects
Status
No status