Skip to content

Commit

Permalink
Important fix for stack overwrite produced by AliESDtrack::GetIntegra…
Browse files Browse the repository at this point in the history
…tedTimes which was ignoring the size of the array given as input. Fixed also the callers of this, which should specify the size.
  • Loading branch information
agheata committed Jan 28, 2015
1 parent bcb60f2 commit ec22d4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions STEER/ESD/AliESDtrack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1887,8 +1887,11 @@ void AliESDtrack::GetIntegratedTimes(Double_t *times, Int_t nspec) const
if(fTrackTime)
for (int i=nspec; i--;) times[i]=fTrackTime[i];
else
for (int i=AliPID::kSPECIESC; i--;) times[i]=0.0;
//
// The line below is wrong since it does not honor the nspec value
// The "times" array may have only AliPID::kSPECIES size, as called by:
// AliESDpidCuts::AcceptTrack()
// for (int i=AliPID::kSPECIESC; i--;) times[i]=0.0;
for (int i=nspec; i--;) times[i]=0.0;
}
//_______________________________________________________________________
Double_t AliESDtrack::GetIntegratedLength() const{
Expand Down
2 changes: 1 addition & 1 deletion STEER/STEER/AliGlobalQADataMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void AliGlobalQADataMaker::MakeESDs(AliESDEvent * event) {
track->GetDZ(xv,yv,zv,esd->GetMagneticField(),dz);
if (dz[1]<3.) {
Double_t times[AliPID::kSPECIESC];
track->GetIntegratedTimes(times);
track->GetIntegratedTimes(times, AliPID::kSPECIESC);
Double_t tof=track->GetTOFsignal()/*-847055 -1771207*/;
FillESDsData(kPid2,times[AliPID::kPion]-tof);
}
Expand Down
2 changes: 1 addition & 1 deletion TOF/TestTOFPID.C
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TestTOFPID(const Char_t *filename, Bool_t calibrateESD = kTRUE, Bool_t correctTE
/* get TOF time */
time = track->GetTOFsignal();
/* get expected times */
track->GetIntegratedTimes(timei);
track->GetIntegratedTimes(timei, AliPID::kSPECIESC);

/* fill PID histos */
for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++){
Expand Down

0 comments on commit ec22d4c

Please sign in to comment.