mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Do not require cookie for reject_protocol
during teardown.
A user reported that they ran into a situation where a parse error caused an assertion failure in `reject_protocol`. printf debugging points to the `CookieSetter`s in the `try`/`catch` blocks during processing already clearing the cookie RAII-style; since their `catch` blocks already send an analyzer violation no further sending of one from `reject_protocol` is required. This patch replaces the assert in `reject_protocol` with a runtime check and an early return if the cookie is already cleared.
This commit is contained in:
parent
0c1a8f8fc4
commit
d97a578e4f
1 changed files with 6 additions and 1 deletions
|
@ -453,7 +453,12 @@ void rt::confirm_protocol() {
|
||||||
void rt::reject_protocol(const std::string& reason) {
|
void rt::reject_protocol(const std::string& reason) {
|
||||||
auto _ = hilti::rt::profiler::start("zeek/rt/reject_protocol");
|
auto _ = hilti::rt::profiler::start("zeek/rt/reject_protocol");
|
||||||
auto cookie = static_cast<Cookie*>(hilti::rt::context::cookie());
|
auto cookie = static_cast<Cookie*>(hilti::rt::context::cookie());
|
||||||
assert(cookie);
|
|
||||||
|
// We might be invoked during teardown when the cookie has already been
|
||||||
|
// cleared. These other code paths also take care of sending an analyzer
|
||||||
|
// violation to Zeek, so we can immediately return for such cases here.
|
||||||
|
if ( ! cookie )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( auto x = cookie->protocol ) {
|
if ( auto x = cookie->protocol ) {
|
||||||
auto tag = spicy_mgr->tagForProtocolAnalyzer(x->analyzer->GetAnalyzerTag());
|
auto tag = spicy_mgr->tagForProtocolAnalyzer(x->analyzer->GetAnalyzerTag());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue