1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

LibWeb: Do not store clipboard items in an unprotected vector

This commit is contained in:
Timothy Flynn 2025-05-01 07:14:50 -04:00 committed by Tim Flynn
parent cf6e2531d9
commit 4a9ed67e9d
Notes: github-actions[bot] 2025-05-02 21:47:55 +00:00

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
* Copyright (c) 2023-2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -167,10 +167,10 @@ GC::Ref<WebIDL::Promise> Clipboard::write_text(String data)
return;
}
// 1. Queue a global task on the clipboard task source, given realms global object, to perform the below steps:
// 3. Queue a global task on the clipboard task source, given realms global object, to perform the below steps:
queue_global_task(HTML::Task::Source::Clipboard, realm.global_object(), GC::create_function(realm.heap(), [&realm, promise, data = move(data)]() mutable {
// 1. Let itemList be an empty sequence<Blob>.
Vector<GC::Ref<FileAPI::Blob>> item_list;
GC::RootVector<GC::Ref<FileAPI::Blob>> item_list(realm.heap());
// 2. Let textBlob be a new Blob created with: type attribute set to "text/plain;charset=utf-8", and its
// underlying byte sequence set to the UTF-8 encoding of data.