You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
GDScript: Add limit to call depth
The hard limit is set at 2048 depth which seems sensible between legitimate recursive calls while still avoiding a crash because of a stack overflow in most of the cases. Note that it is still possible to reach the stack limit and get an overflow before reaching a call depth. This is intended as a half-way measure to stop crashing in most cases, since there's no reliable nor portable way to check the amount of stack memory left.
This commit is contained in:
@@ -544,6 +544,8 @@ private:
|
||||
#endif
|
||||
|
||||
public:
|
||||
static constexpr int MAX_CALL_DEPTH = 2048; // Limit to try to avoid crash because of a stack overflow.
|
||||
|
||||
struct CallState {
|
||||
GDScript *script = nullptr;
|
||||
GDScriptInstance *instance = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user