HackStudio: Avoid UAF when loading the GML preview

The value returned by editor().text() was a temporarily allocated string
which we were holding a view into.
This commit is contained in:
Timothy Flynn 2024-04-03 21:53:01 -04:00 committed by Andreas Kling
parent decc00dcdf
commit e57d739705

View file

@ -1699,7 +1699,7 @@ bool HackStudioWidget::any_document_is_dirty() const
void HackStudioWidget::update_gml_preview()
{
auto gml_content = current_editor_wrapper().filename().ends_with(".gml"sv) ? current_editor_wrapper().editor().text().view() : ""sv;
auto gml_content = current_editor_wrapper().filename().ends_with(".gml"sv) ? current_editor_wrapper().editor().text() : ByteString::empty();
m_gml_preview_widget->load_gml(gml_content);
}