Problem 951 - Segfault Bug G4RunManager::StackPreviousEvent
Summary: Segfault Bug G4RunManager::StackPreviousEvent
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: run (show other problems)
Version: 8.3
Hardware: All All
: P5 critical
Assignee: asai
URL:
Depends on:
Blocks:
 
Reported: 2007-06-20 18:41 CEST by robert.a.weller
Modified: 2007-06-20 19:12 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description robert.a.weller 2007-06-20 18:41:24 CEST
In the last line of the subject function the evt pointer is dereferenced without checking that it can be null. In fact it is null until the previousEvents vector gets full.
This code fixes the problem:
if(evt && !(evt->ToBeKept())) delete evt;
It replaces the last line of the function as it appears in Geant4.8.3.

In the absence of this fix, setting the number of events to be saved and running events produces a seg fault when evt->ToBeKept tries to do 0->ToBeKept.

Regards to all from Bob and Marcus.
Comment 1 asai 2007-06-20 19:12:24 CEST
Thanks Bob and Marcus for reporting this.
The fix is now committed to CVS and to be
included in the coming release.

Makoto