GH-1503: Improve &expire_func compatibility type-checking

Previously, incompatible &expire_funcs could mistakenly be used, such as
when using that attribute on the unspecified table()/set()
initializations/assignments, resulting in invalid function calls that
eventually crash Zeek.
This commit is contained in:
Jon Siwek 2021-04-12 16:27:50 -07:00
parent 0c93e2fcb8
commit 01f6264c87
6 changed files with 85 additions and 46 deletions

View file

@ -391,6 +391,15 @@ class TableType : public IndexType {
public:
TableType(TypeListPtr ind, TypePtr yield);
/**
* Assesses whether an &expire_func attribute's function type is compatible
* with this table type.
* @param attr the &expire_func attribute to check (this method must not be
* called with other type of attributes).
* @return true if compatible, false if not
*/
bool CheckExpireFuncCompatibility(const detail::AttrPtr& attr);
TypePtr ShallowClone() override;
// Returns true if this table type is "unspecified", which is