diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-13 11:24:51 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-13 11:24:51 +0100 |
commit | 76170379b305019bcaca5a9fa8dc07a9b259de3e (patch) | |
tree | f9e5ba868cd44e137010a880599c466b65b6612e /editor | |
parent | 50e72516c1bd492dde5fa9525173294a49b5a97e (diff) | |
parent | a938359cd33099116a40724a5b1bfe422cdd8744 (diff) | |
download | redot-engine-76170379b305019bcaca5a9fa8dc07a9b259de3e.tar.gz |
Merge pull request #86633 from rune-scape/regression-79882
Fix possible crash (use after free) in ScriptTextEditor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index c48cbd8c20..9baf0c60dd 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -500,11 +500,14 @@ void ScriptTextEditor::_validate_script() { safe_lines.clear(); if (!script->get_language()->validate(text, script->get_path(), &fnc, &errors, &warnings, &safe_lines)) { - for (List<ScriptLanguage::ScriptError>::Element *E = errors.front(); E; E = E->next()) { + List<ScriptLanguage::ScriptError>::Element *E = errors.front(); + while (E) { + List<ScriptLanguage::ScriptError>::Element *next_E = E->next(); if ((E->get().path.is_empty() && !script->get_path().is_empty()) || E->get().path != script->get_path()) { depended_errors[E->get().path].push_back(E->get()); E->erase(); } + E = next_E; } if (errors.size() > 0) { |