Просмотр исходного кода

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.
Timothy Flynn 1 год назад
Родитель
Сommit
e57d739705
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      Userland/DevTools/HackStudio/HackStudioWidget.cpp

+ 1 - 1
Userland/DevTools/HackStudio/HackStudioWidget.cpp

@@ -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);
 }