Using an undefined function in a when statement causes a segfault

Description

Running the following script crashes bro with a null-pointer exception:

crashMe.bro

Backtrace:

Environment

None

Activity

Show:
Johanna Amann
October 29, 2014, 9:34 PM

As Christian described in with another testcase, this does not only work with functions but with all kinds of variables.

Jon Siwek
October 30, 2014, 5:26 PM

What's the expected behavior?

It doesn't look like something easily detected at parse-time, so ideas:

(1) fatal error message at run-time with a core dump should the code ever be executed (which may be infrequently if it's buried within complicated logic).

(2) nonfatal error message at run-time, but the when body can still be triggered as normal if the RHS is ever assigned a value.

topic/jsiwek/bit-1176 does (2). If that seems ok, please flip ticket to a merge request.

Johanna Amann
October 30, 2014, 5:50 PM

(2) is fine from my point of view, flipping to merge request.

Thank you.

Assignee

Robin Sommer

Reporter

Johanna Amann

Labels

None

External issue ID

None

Components

Fix versions

Affects versions

Priority

Normal
Configure