vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.5k stars 2.15k forks source link

checker: limit recursion in Checker.ensure_type_exists/2 to 40 levels (it is usually 4 or less) #21734

Closed spytheman closed 3 days ago

spytheman commented 3 days ago

Make the recursive method ensure_type_exists/2 a bit more robust, by terminating early, when the recursion depth exceeds a hard limit of 40 levels.

Without it, an unlimited recursion (which may be caused by various factors) will lead to a stack overflow, which can be harder to diagnose, than an explicit checker error message.