From 9f5f8b809a96708e1cad0c6def5d45f26b03e7ff Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Tue, 6 Aug 2024 17:45:58 +0200 Subject: [PATCH] spicy/runtime-support: Switch ParameterMismatch::_fmt to static UBSAN's vptr sanitize isn't happy with the call to _fmt() in its member initializer list. $ zeek -r Traces/ssh/single-conn.trace .tmp/spicy.event-args-mismatch/test.hlto .tmp/spicy.event-args-mismatch/event-args-mismatch.zeek <...>/src/include/zeek/spicy/runtime-support.h:80:29: runtime error: member call on address 0x511000369540 which does not point to an object of type 'zeek::spicy::rt::ParameterMismatch' 0x511000369540: note: object has invalid vptr 00 00 00 00 be be be be be be be be be be be be be be be be be be be be be be be be be be be be ^~~~~~~~~~~~~~~~~~~~~~~ invalid vptr #0 0x7f9c9977b019 in zeek::spicy::rt::ParameterMismatch::ParameterMismatch(std::basic_string_view>, zeek::IntrusivePtr const&, std::basic_string_view>) <...>/src/include/zeek/spicy/runtime-support.h:80:29 #1 0x7f9c9977a6a2 in zeek::spicy::rt::to_val(hilti::rt::Bytes const&, zeek::IntrusivePtr const&) <...>/src/include/zeek/spicy/runtime-support.h:562:15 --- src/spicy/runtime-support.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spicy/runtime-support.h b/src/spicy/runtime-support.h index 9ffef2d9d0..0397dc86cc 100644 --- a/src/spicy/runtime-support.h +++ b/src/spicy/runtime-support.h @@ -80,7 +80,7 @@ public: : ParameterMismatch(_fmt(have, want)) {} private: - std::string _fmt(const std::string_view& have, const TypePtr& want) { + static std::string _fmt(const std::string_view& have, const TypePtr& want) { ODesc d; want->Describe(&d); return hilti::rt::fmt("cannot convert Spicy value of type '%s' to Zeek value of type '%s'", have,