Skip to content

Commit

Permalink
Merge pull request #86633 from rune-scape/regression-79882
Browse files Browse the repository at this point in the history
Fix possible crash (use after free) in ScriptTextEditor
  • Loading branch information
akien-mga committed Feb 13, 2024
2 parents 50e7251 + a938359 commit 7617037
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7617037

Please sign in to comment.