mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
input/Manager: Improve type checks of record fields with type any
Calling AsRecordType() or AsFunc() on a Val of type any isn't safe. Closes #3836
This commit is contained in:
parent
0ba80d13b4
commit
3797622152
3 changed files with 70 additions and 1 deletions
|
@ -59,6 +59,7 @@ global val_table: table[count] of Val = table();
|
|||
global val_table2: table[count, int] of Val = table();
|
||||
global val_table3: table[count, int] of int = table();
|
||||
global val_table4: table[count] of int;
|
||||
global val_set: set[count];
|
||||
|
||||
event line_file(description: Input::EventDescription, tpe: Input::Event, r:FileVal)
|
||||
{
|
||||
|
@ -190,5 +191,15 @@ event zeek_init()
|
|||
|
||||
Input::add_table([$source="input.log", $name="error6", $idx=Idx, $destination=val_table]);
|
||||
|
||||
# Check that we do not crash when a user passes unexpected types to any fields in the description records.
|
||||
Input::add_table([$source="input.log", $name="types1", $idx="string-is-not-allowed", $destination=val_set]);
|
||||
Input::add_table([$source="input.log", $name="types2", $idx=Idx, $val="string-is-not-allowed", $destination=val_set]);
|
||||
Input::add_table([$source="input.log", $name="types3", $idx=Idx, $destination="string-is-not-allowed"]);
|
||||
Input::add_table([$source="input.log", $name="types4", $idx=Idx, $destination=val_set, $ev="not-an-event"]);
|
||||
Input::add_table([$source="input.log", $name="types5", $idx=Idx, $destination=val_set, $error_ev="not-an-event"]);
|
||||
Input::add_event([$source="input.log", $name="types6", $fields="string-is-not-allowed", $ev=event11]);
|
||||
Input::add_event([$source="input.log", $name="types7", $fields=Val, $ev="not-an-event"]);
|
||||
Input::add_event([$source="input.log", $name="types8", $fields=Val, $ev=event11, $error_ev="not-an-event"]);
|
||||
|
||||
schedule 3secs { kill_me() };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue