Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TClonesArray::Expand* avoid nullptr dereference if object is invalid
  • Loading branch information
pcanal committed Jun 18, 2019
commit 255dad6827d87e3e8df520bfdffbb5c876baca7b
10 changes: 9 additions & 1 deletion core/cont/src/TClonesArray.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ void TClonesArray::Expand(Int_t newSize)
Error ("Expand", "newSize must be positive (%d)", newSize);
return;
}
if (!fKeep) {
Error("ExpandCreate", "Not initialized properly, fKeep is still a nullptr");
return;
}
if (newSize == fSize)
return;
if (newSize < fSize) {
Expand Down Expand Up @@ -497,7 +501,11 @@ void TClonesArray::ExpandCreate(Int_t n)
{
if (n < 0) {
Error("ExpandCreate", "n must be positive (%d)", n);
return ;
return;
}
if (!fKeep) {
Error("ExpandCreate", "Not initialized properly, fKeep is still a nullptr");
return;
}
if (n > fSize)
Expand(TMath::Max(n, GrowBy(fSize)));
Expand Down