diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-02-02 07:29:19 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-02 19:14:00 +0000 |
commit | 7c1fe32af3c37577ff8b04ada364be6e61ce8a9c (patch) | |
tree | 2500388721f2a17b1c00994b4d86d3b15dde0008 /Userland/Services/WebContent | |
parent | 2af7447dfd598bbcabf8666211b3d09173b3fe8f (diff) | |
download | serenity-7c1fe32af3c37577ff8b04ada364be6e61ce8a9c.zip |
WebContent: Remove pending file requests before invoking their callbacks
It's currently possible for the callback of a file request to request
more file objects. This could cause the hash map storing these requests
to be rehashed while one of its callbacks is being invoked. AK::Function
explicitly forbids this with an assertion.
Instead, remove the callback from the hash map before invoking the
callback function.
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r-- | Userland/Services/WebContent/ConnectionFromClient.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 3c4e00361f..0f77cfe40b 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -562,13 +562,12 @@ Messages::WebContentServer::GetSessionStorageEntriesResponse ConnectionFromClien void ConnectionFromClient::handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id) { - auto file_request = m_requested_files.get(request_id); + auto file_request = m_requested_files.take(request_id); VERIFY(file_request.has_value()); VERIFY(file_request.value().on_file_request_finish); file_request.value().on_file_request_finish(error != 0 ? Error::from_errno(error) : ErrorOr<i32> { file->take_fd() }); - m_requested_files.remove(request_id); } void ConnectionFromClient::request_file(Web::FileRequest file_request) |