mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
broker/messaging: Runtime type checks for pool
publish_hrw() and publish_rr() are excluded from type checking due to their variadic nature. Passing a wrong type for the pool argument previously triggered an abort, now the result is runtime errors. This isn't great, but it's better than crashing Zeek. Closes #2935
This commit is contained in:
parent
5aae4381d7
commit
f44279cc3e
3 changed files with 49 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
# @TEST-DOC: Check that Cluster::publish_hrw() and Cluster::publish_rr() do not cause an abort when provided with wrongly typed arguments.
|
||||
# @TEST-EXEC: zeek -b %INPUT
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||
|
||||
@load base/frameworks/cluster
|
||||
|
||||
type R: record {
|
||||
a: string;
|
||||
};
|
||||
|
||||
event test_send(r: R) { }
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
Cluster::publish_hrw("/topic", 1234/tcp, test_send, [$a="a"]);
|
||||
|
||||
Cluster::publish_hrw(0, 1234/tcp, test_send, [$a="a"]);
|
||||
|
||||
Cluster::publish_rr("/topic", "val", test_send, [$a="b"]);
|
||||
|
||||
Cluster::publish_rr(Cluster::Pool(), 1234/tcp, test_send, [$a="c"]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue