Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Issue 920123002: Fix a crash in the FileStream::Context::Read code path where we were invoking a NULL callback. (Closed)

Created:
5 years, 10 months ago by ananta
Modified:
5 years, 10 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix a crash in the FileStream::Context::Read code path where we were invoking a NULL callback. This could happen if if the ReadFileAsync completion calls OnIOComplete for an orphanaed object. Fix is to rework the way these callbacks work. 1. Handle the case where in an orphaned context could be deleted before the read async completion callback is received. 2. Pass the return of the ReadFile call to the ReadAsyncResult callback. The logic to call the IO completion routine or the user callback has been consolidated in this function. BUG=458253 Committed: https://crrev.com/47f234d399caaa4fe270896ee5393265acf9ed8c Cr-Commit-Position: refs/heads/master@{#316362}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Address review comments #

Total comments: 9

Patch Set 3 : Address review comments and handle orphaned objects #

Patch Set 4 : Fixed bonheaded bug #

Patch Set 5 : Reset result_ in InvokeUserCallback #

Total comments: 11

Patch Set 6 : Addressed review comments #

Patch Set 7 : Fix code #

Patch Set 8 : Fix build #

Patch Set 9 : reset result_ to 0 #

Patch Set 10 : Removed null callback check #

Patch Set 11 : Fixed Windows trybot redness #

Total comments: 4

Patch Set 12 : Address review comments #

Total comments: 4

Patch Set 13 : Address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -21 lines) Patch
M net/base/file_stream_context.h View 1 2 2 chunks +6 lines, -1 line 0 comments Download
M net/base/file_stream_context_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +39 lines, -20 lines 0 comments Download

Messages

Total messages: 29 (7 generated)
ananta
5 years, 10 months ago (2015-02-12 20:28:08 UTC) #2
rvargas (doing something else)
https://codereview.chromium.org/920123002/diff/1/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/1/net/base/file_stream_context_win.cc#newcode208 net/base/file_stream_context_win.cc:208: FROM_HERE, base::Bind(&FileStream::Context::ReadAsyncResult, ret = TRUE + a completion callback ...
5 years, 10 months ago (2015-02-12 22:24:54 UTC) #3
ananta
https://codereview.chromium.org/920123002/diff/1/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/1/net/base/file_stream_context_win.cc#newcode208 net/base/file_stream_context_win.cc:208: FROM_HERE, base::Bind(&FileStream::Context::ReadAsyncResult, On 2015/02/12 22:24:54, rvargas wrote: > ret ...
5 years, 10 months ago (2015-02-12 22:47:59 UTC) #4
rvargas (doing something else)
https://codereview.chromium.org/920123002/diff/20001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/20001/net/base/file_stream_context_win.cc#newcode156 net/base/file_stream_context_win.cc:156: CloseAndDelete(); This looks wrong to me. Aren't we deleting ...
5 years, 10 months ago (2015-02-12 23:53:35 UTC) #5
ananta
https://codereview.chromium.org/920123002/diff/20001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/20001/net/base/file_stream_context_win.cc#newcode156 net/base/file_stream_context_win.cc:156: CloseAndDelete(); On 2015/02/12 23:53:35, rvargas wrote: > This looks ...
5 years, 10 months ago (2015-02-13 00:17:01 UTC) #6
ananta
https://codereview.chromium.org/920123002/diff/20001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/20001/net/base/file_stream_context_win.cc#newcode167 net/base/file_stream_context_win.cc:167: IncrementOffset(&io_context_.overlapped, bytes_read); On 2015/02/13 00:17:01, ananta wrote: > On ...
5 years, 10 months ago (2015-02-13 00:36:38 UTC) #7
rvargas (doing something else)
Almost there https://codereview.chromium.org/920123002/diff/80001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/80001/net/base/file_stream_context_win.cc#newcode181 net/base/file_stream_context_win.cc:181: if (callback_.is_null()) Should not need this. https://codereview.chromium.org/920123002/diff/80001/net/base/file_stream_context_win.cc#newcode194 ...
5 years, 10 months ago (2015-02-13 02:05:58 UTC) #8
ananta
https://codereview.chromium.org/920123002/diff/80001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/80001/net/base/file_stream_context_win.cc#newcode181 net/base/file_stream_context_win.cc:181: if (callback_.is_null()) On 2015/02/13 02:05:57, rvargas wrote: > Should ...
5 years, 10 months ago (2015-02-13 02:22:14 UTC) #9
rvargas (doing something else)
https://codereview.chromium.org/920123002/diff/80001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/80001/net/base/file_stream_context_win.cc#newcode181 net/base/file_stream_context_win.cc:181: if (callback_.is_null()) On 2015/02/13 02:22:14, ananta wrote: > On ...
5 years, 10 months ago (2015-02-13 02:26:05 UTC) #10
rvargas (doing something else)
LGTM
5 years, 10 months ago (2015-02-13 02:38:51 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/920123002/180001
5 years, 10 months ago (2015-02-13 02:40:47 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_rel on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_rel/builds/54148)
5 years, 10 months ago (2015-02-13 04:17:47 UTC) #15
rvargas (doing something else)
https://codereview.chromium.org/920123002/diff/200001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/200001/net/base/file_stream_context_win.cc#newcode236 net/base/file_stream_context_win.cc:236: if (read_file_ret || io_complete_for_read_received_) { Sounds like an else ...
5 years, 10 months ago (2015-02-13 18:22:44 UTC) #17
ananta
https://codereview.chromium.org/920123002/diff/200001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/200001/net/base/file_stream_context_win.cc#newcode236 net/base/file_stream_context_win.cc:236: if (read_file_ret || io_complete_for_read_received_) { On 2015/02/13 18:22:44, rvargas ...
5 years, 10 months ago (2015-02-13 19:35:05 UTC) #18
rvargas (doing something else)
https://codereview.chromium.org/920123002/diff/220001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/220001/net/base/file_stream_context_win.cc#newcode237 net/base/file_stream_context_win.cc:237: InvokeUserCallback(); if we don't set result_ here, bytes_read becomes ...
5 years, 10 months ago (2015-02-13 19:53:06 UTC) #19
ananta
https://codereview.chromium.org/920123002/diff/220001/net/base/file_stream_context_win.cc File net/base/file_stream_context_win.cc (right): https://codereview.chromium.org/920123002/diff/220001/net/base/file_stream_context_win.cc#newcode237 net/base/file_stream_context_win.cc:237: InvokeUserCallback(); On 2015/02/13 19:53:06, rvargas wrote: > if we ...
5 years, 10 months ago (2015-02-13 23:07:54 UTC) #20
rvargas (doing something else)
lgtm
5 years, 10 months ago (2015-02-13 23:31:22 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/920123002/240001
5 years, 10 months ago (2015-02-14 00:02:00 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/25204)
5 years, 10 months ago (2015-02-14 01:03:10 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/920123002/240001
5 years, 10 months ago (2015-02-14 01:10:16 UTC) #27
commit-bot: I haz the power
Committed patchset #13 (id:240001)
5 years, 10 months ago (2015-02-14 02:11:04 UTC) #28
commit-bot: I haz the power
5 years, 10 months ago (2015-02-14 02:11:50 UTC) #29
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/47f234d399caaa4fe270896ee5393265acf9ed8c
Cr-Commit-Position: refs/heads/master@{#316362}

Powered by Google App Engine
This is Rietveld 408576698