mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fixes to limit AST traversal in the face of recursive types
This commit is contained in:
parent
910a2f6c59
commit
691a4003b7
2 changed files with 20 additions and 0 deletions
|
@ -58,6 +58,15 @@ public:
|
|||
return TC_CONTINUE;
|
||||
}
|
||||
|
||||
TraversalCode PreType(const Type* t) override {
|
||||
if ( types_seen.count(t) > 0 )
|
||||
return TC_ABORTSTMT;
|
||||
|
||||
types_seen.insert(t);
|
||||
|
||||
return TC_CONTINUE;
|
||||
}
|
||||
|
||||
void SetHookDepth(int hd) { hook_depth = hd; }
|
||||
|
||||
bool IsValid() const { return valid_script; }
|
||||
|
@ -83,6 +92,7 @@ private:
|
|||
}
|
||||
|
||||
std::unordered_map<StmtTag, int> stmt_depths;
|
||||
std::unordered_set<const Type*> types_seen;
|
||||
int hook_depth = 0;
|
||||
bool report; // whether to report problems via "reporter"
|
||||
bool valid_script = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue