summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_editor.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-26 13:43:48 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-26 13:43:48 +0200
commit2a61a2fa2f1d537ea57a9a225d202393d491bd47 (patch)
tree49f5860570b013a3ef91069e702a7e82b6dd8737 /modules/gdscript/gdscript_editor.cpp
parente343dbbcc1030f04dc5833f1c19d267a17332ca9 (diff)
parent7426b4d448102a312009b133497af55214e2b4c5 (diff)
downloadredot-engine-2a61a2fa2f1d537ea57a9a225d202393d491bd47.tar.gz
Merge pull request #89274 from 0x0ACB/unchecked_cast
Fix use after free in `GDScriptLanguage::debug_get_globals`
Diffstat (limited to 'modules/gdscript/gdscript_editor.cpp')
-rw-r--r--modules/gdscript/gdscript_editor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 28a030e492..822fc412b4 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -402,7 +402,9 @@ void GDScriptLanguage::debug_get_globals(List<String> *p_globals, List<Variant>
}
const Variant &var = gl_array[E.value];
- if (Object *obj = var) {
+ bool freed = false;
+ const Object *obj = var.get_validated_object_with_check(freed);
+ if (obj && !freed) {
if (Object::cast_to<GDScriptNativeClass>(obj)) {
continue;
}