zeek/spicy

Optimizer gets confused if e.g., unit names contain double underscores

Closed this issue · 1 comments

In order to track feature requirements the optimizer uses variables with names derived from the unit name, e.g., for a unit foo::Bar we generate feature variables __feat%foo__Bar. We here normalize : as _. Since _ is valid in user-specified identifiers this can clash with user code similar to #1499, e.g.,

# foo.spicy
module foo;

public type X__x = unit {
    on %init { print self.offset(); }
};
$ echo | spicy-driver foo.spicy
[error] terminating with uncaught exception of type hilti::rt::UnsetOptional: unset optional value (foo.spicy:5:16)

In all versions before this fix, users should avoid using double underscores in type names.