mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix crash when using debug.log.
It turns out that bro -B all caused a segmentation fault since the configuration framework was merged; this is caused by the fact that calling the global_ids bif interacted poorly with -B all due to side-effects that caused insertions into the global scope in the global_ids loop.
This commit is contained in:
parent
49a30d61cf
commit
1ee96516e8
1 changed files with 11 additions and 0 deletions
11
src/bro.bif
11
src/bro.bif
|
@ -1843,6 +1843,17 @@ function global_ids%(%): id_table
|
|||
TableVal* ids = new TableVal(id_table);
|
||||
PDict(ID)* globals = global_scope()->Vars();
|
||||
IterCookie* c = globals->InitForIteration();
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Explanation time: c needs to be a robust cookie when one is in debug mode,
|
||||
* otherwise the Zeek process will crash in ~80% of cases when -B all is specified.
|
||||
* The reason for this are the RecordVals that we create. RecordVal::Assign triggers
|
||||
* a StateAccess::Log, which in turn (only in debug mode) triggers StateAccess::Describe,
|
||||
* which creates a UniqueID for the variable, which triggers an insert into global_scope.
|
||||
* Which invalidates the iteration cookie if it is not robust.
|
||||
**/
|
||||
globals->MakeRobustCookie(c);
|
||||
#endif
|
||||
|
||||
ID* id;
|
||||
while ( (id = globals->NextEntry(c)) )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue