mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Add enum value negative check
There was one already at parse time, this adds a check later so that cases like overflows or internal enums with negative values get caught.
This commit is contained in:
parent
d3dd8a155d
commit
08348cd177
3 changed files with 16 additions and 0 deletions
|
@ -1542,6 +1542,12 @@ void EnumType::CheckAndAddName(const string& module_name, const char* name, zeek
|
|||
return;
|
||||
}
|
||||
|
||||
if ( val < 0 ) {
|
||||
reporter->Error("enumerator value cannot be negative");
|
||||
SetError();
|
||||
return;
|
||||
}
|
||||
|
||||
auto fullname = detail::make_full_var_name(module_name.c_str(), name);
|
||||
auto id = id::find(fullname);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue