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

Issue 301973007: [fsp] Fix crash when reading files. (Closed)

Created:
6 years, 6 months ago by mtomasz
Modified:
6 years, 6 months ago
Reviewers:
kinaba
CC:
chromium-reviews, nkostylev+watch_chromium.org, tzik, nhiroki, oshima+watch_chromium.org, stevenjb+watch_chromium.org, kinuko+fileapi, davemoore+watch_chromium.org
Visibility:
Public.

Description

[fsp] Fix crash when reading files. Before, the net::IOBuffer was being passed as a pointer, from the FileStreamReader::Read to operations::ReadFile. However, there are PostTask invocations on the way. When FileStreamReader is deleted after a PostTask is fired from FileStreamReader::Read, and the operation is not completed, then the net::IOBuffer will become invalid. When the operation is completed, operation::ReadFile would cause a segmentation fault. Since net::IOBuffer is ref counted, we should pass it as ref counted object to be sure, that the buffer is always valid. This patch migrates from passing IOBuffer as a pointer, to scoped_refptr. TEST=Tested manually, that crashing doesn't occur anymore. BUG=248427 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=274174

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressed comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -8 lines) Patch
M chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.h View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc View 1 4 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/chromeos/file_system_provider/operations/read_file.h View 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/file_system_provider/operations/read_file.cc View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
mtomasz
@kinaba: PTAL. Thanks.
6 years, 6 months ago (2014-05-30 04:29:17 UTC) #1
kinaba
https://codereview.chromium.org/301973007/diff/1/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc File chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc (right): https://codereview.chromium.org/301973007/diff/1/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc#newcode87 chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc:87: net::IOBuffer* buffer, What about taking scoped_refptr<net::IOBuffer> as the arugment ...
6 years, 6 months ago (2014-05-30 04:42:10 UTC) #2
mtomasz
https://codereview.chromium.org/301973007/diff/1/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc File chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc (right): https://codereview.chromium.org/301973007/diff/1/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc#newcode87 chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc:87: net::IOBuffer* buffer, On 2014/05/30 04:42:10, kinaba wrote: > What ...
6 years, 6 months ago (2014-06-02 00:47:51 UTC) #3
kinaba
lgtm
6 years, 6 months ago (2014-06-02 01:10:46 UTC) #4
mtomasz
The CQ bit was checked by mtomasz@chromium.org
6 years, 6 months ago (2014-06-02 02:00:00 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mtomasz@chromium.org/301973007/20001
6 years, 6 months ago (2014-06-02 02:00:14 UTC) #6
commit-bot: I haz the power
6 years, 6 months ago (2014-06-02 05:50:58 UTC) #7
Message was sent while issue was closed.
Change committed as 274174

Powered by Google App Engine
This is Rietveld 408576698