Commit 6e40985c authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

[FileApi] Fix potential use-after-free in FileReaderLoader.

Bug: 873844
Change-Id: Ib01659c5e072806782bae4682cd1e875d06fc40e
Reviewed-on: https://chromium-review.googlesource.com/1173485
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Daniel Murphy <dmurph@chromium.org>
Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582789}
parent f587b41f
......@@ -365,7 +365,14 @@ void FileReaderLoader::OnDataPipeReadable(MojoResult result) {
FailureType::kMojoPipeUnexpectedReadError);
return;
}
auto weak_this = weak_factory_.GetWeakPtr();
OnReceivedData(static_cast<const char*>(buffer), num_bytes);
// OnReceivedData calls out to our client, which could delete |this|, so
// bail out if that happened.
if (!weak_this)
return;
consumer_handle_->EndReadData(num_bytes);
if (BytesLoaded() >= total_bytes_) {
received_all_data_ = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment