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

Issue 683913009: Eliminate resource leaks from zip::ZipFiles and (Closed)

Created:
6 years, 1 month ago by jeremyspiegel
Modified:
6 years, 1 month ago
CC:
chromium-reviews, grt+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Eliminate resource leaks from zip::ZipFiles and zip::ZipReader::OpenFromPlatformFile. zip::ZipFiles and zip::ZipReader::OpenFromPlatformFile do not want to take ownership of the passed-in file. On POSIX, dup the file descriptor to pass to fopen, so that that we can safely fclose the result. On Windows, stop closing the file handle. Fix consumers of these functions that assumed ownership was being passed to instead close the file themselves. BUG=430959 Committed: https://crrev.com/b2eae6046c3aa484cc5019615f925a7bc178fa1b Cr-Commit-Position: refs/heads/master@{#304930}

Patch Set 1 #

Total comments: 8

Patch Set 2 : Add test case, base::ScopedFD, comment for free() #

Total comments: 2

Patch Set 3 : Rename file closer, add comment, reorder ZipReader/FileWrapper, change test iteration count #

Total comments: 3

Patch Set 4 : Rename CloseFileFunc to FdCloseFileFunc, try to document ownership in zip_internal.cc #

Patch Set 5 : Finish renaming CloseFileFunc to FdCloseFileFunc (submitted last patch set too soon) #

Patch Set 6 : Rebasing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+38 lines, -18 lines) Patch
M AUTHORS View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/safe_browsing/zip_analyzer.cc View 1 2 3 4 5 1 chunk +1 line, -4 lines 0 comments Download
M chrome/utility/chrome_content_utility_client.cc View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/zlib/google/zip.h View 1 chunk +4 lines, -3 lines 0 comments Download
M third_party/zlib/google/zip_internal.cc View 1 2 3 4 6 chunks +18 lines, -9 lines 0 comments Download
M third_party/zlib/google/zip_reader.h View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/zlib/google/zip_reader_unittest.cc View 1 2 1 chunk +9 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (11 generated)
jeremyspiegel
Hi, this is my first contribution, so please forgive me for any mistakes in the ...
6 years, 1 month ago (2014-11-08 23:40:45 UTC) #3
satorux1
Thank you for sending us the patch.I was out of the office today. I'll have ...
6 years, 1 month ago (2014-11-10 09:58:44 UTC) #4
satorux1
Thank you for sending us the fix! > I have a test case that exposes ...
6 years, 1 month ago (2014-11-12 07:04:44 UTC) #5
satorux1
BTW, sorry for the late response. I was swamped yesterday.
6 years, 1 month ago (2014-11-12 07:05:09 UTC) #6
jeremyspiegel
On 2014/11/12 07:04:44, satorux1 wrote: > Thank you for sending us the fix! > BTW, ...
6 years, 1 month ago (2014-11-12 08:51:46 UTC) #7
jeremyspiegel
https://codereview.chromium.org/683913009/diff/1/chrome/utility/chrome_content_utility_client.cc File chrome/utility/chrome_content_utility_client.cc (right): https://codereview.chromium.org/683913009/diff/1/chrome/utility/chrome_content_utility_client.cc#newcode252 chrome/utility/chrome_content_utility_client.cc:252: base::File dest_file(dest_fd); On 2014/11/12 07:04:43, satorux1 wrote: > This ...
6 years, 1 month ago (2014-11-12 08:52:52 UTC) #8
satorux1
https://codereview.chromium.org/683913009/diff/1/third_party/zlib/google/zip_reader_unittest.cc File third_party/zlib/google/zip_reader_unittest.cc (right): https://codereview.chromium.org/683913009/diff/1/third_party/zlib/google/zip_reader_unittest.cc#newcode183 third_party/zlib/google/zip_reader_unittest.cc:183: FileWrapper zip_fd_wrapper(test_zip_file_, FileWrapper::READ_ONLY); On 2014/11/12 08:52:51, jeremyspiegel wrote: > ...
6 years, 1 month ago (2014-11-14 02:27:51 UTC) #9
satorux1
On 2014/11/12 08:51:46, jeremyspiegel wrote: > On 2014/11/12 07:04:44, satorux1 wrote: > > Thank you ...
6 years, 1 month ago (2014-11-14 02:28:44 UTC) #10
jeremyspiegel
https://codereview.chromium.org/683913009/diff/1/third_party/zlib/google/zip_reader_unittest.cc File third_party/zlib/google/zip_reader_unittest.cc (right): https://codereview.chromium.org/683913009/diff/1/third_party/zlib/google/zip_reader_unittest.cc#newcode183 third_party/zlib/google/zip_reader_unittest.cc:183: FileWrapper zip_fd_wrapper(test_zip_file_, FileWrapper::READ_ONLY); > I see. There are many ...
6 years, 1 month ago (2014-11-14 23:49:26 UTC) #11
jeremyspiegel
> I think the number of iterations does not have to be precise. Maybe 100000 ...
6 years, 1 month ago (2014-11-14 23:49:46 UTC) #12
satorux1
third_party/zlib/google LGTM noelutz@ and jhawkins@ please take a look at other files.
6 years, 1 month ago (2014-11-17 00:55:50 UTC) #13
James Hawkins
https://codereview.chromium.org/683913009/diff/40001/third_party/zlib/google/zip_internal.cc File third_party/zlib/google/zip_internal.cc (right): https://codereview.chromium.org/683913009/diff/40001/third_party/zlib/google/zip_internal.cc#newcode135 third_party/zlib/google/zip_internal.cc:135: int HandleCloseFileFunc(void* opaque, void* stream) { Can we provide ...
6 years, 1 month ago (2014-11-17 23:10:38 UTC) #14
jeremyspiegel
https://codereview.chromium.org/683913009/diff/40001/third_party/zlib/google/zip_internal.cc File third_party/zlib/google/zip_internal.cc (right): https://codereview.chromium.org/683913009/diff/40001/third_party/zlib/google/zip_internal.cc#newcode135 third_party/zlib/google/zip_internal.cc:135: int HandleCloseFileFunc(void* opaque, void* stream) { On 2014/11/17 23:10:38, ...
6 years, 1 month ago (2014-11-17 23:13:50 UTC) #15
James Hawkins
https://codereview.chromium.org/683913009/diff/40001/third_party/zlib/google/zip_internal.cc File third_party/zlib/google/zip_internal.cc (right): https://codereview.chromium.org/683913009/diff/40001/third_party/zlib/google/zip_internal.cc#newcode135 third_party/zlib/google/zip_internal.cc:135: int HandleCloseFileFunc(void* opaque, void* stream) { On 2014/11/17 23:13:50, ...
6 years, 1 month ago (2014-11-17 23:28:39 UTC) #16
jeremyspiegel
> It'd also be good to document the ownership and lifecycles of > these objects ...
6 years, 1 month ago (2014-11-17 23:34:58 UTC) #17
James Hawkins
lgtm
6 years, 1 month ago (2014-11-18 00:02:13 UTC) #18
satorux1
+shess@ for chrome/common/safe_browsing/zip_analyzer.cc in case noelutz@ is out of town
6 years, 1 month ago (2014-11-19 07:40:12 UTC) #26
satorux1
oops. shess@ seems to be on leave. adding +mattm@ for chrome/common/safe_browsing/zip_analyzer.cc
6 years, 1 month ago (2014-11-19 07:41:11 UTC) #28
mattm
safe_browsing lgtm
6 years, 1 month ago (2014-11-19 22:45:20 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/683913009/100001
6 years, 1 month ago (2014-11-19 22:58:19 UTC) #31
commit-bot: I haz the power
Committed patchset #6 (id:100001)
6 years, 1 month ago (2014-11-19 23:53:23 UTC) #32
commit-bot: I haz the power
6 years, 1 month ago (2014-11-19 23:54:14 UTC) #33
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/b2eae6046c3aa484cc5019615f925a7bc178fa1b
Cr-Commit-Position: refs/heads/master@{#304930}

Powered by Google App Engine
This is Rietveld 408576698