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

Issue 289333002: Mojo cpp bindings: validation logic for incoming messages (Closed)

Created:
6 years, 7 months ago by yzshen1
Modified:
6 years, 6 months ago
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, ben+mojo_chromium.org
Visibility:
Public.

Description

Mojo cpp bindings: validation logic for incoming messages BUG=None TEST=None Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=274005

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : Implement BoundsChecker #

Patch Set 4 : Add unittests for BoundsChecker #

Patch Set 5 : cleanup #

Patch Set 6 : rebase #

Patch Set 7 : #

Total comments: 18

Patch Set 8 : changes according to Tom's suggestions #

Total comments: 6

Patch Set 9 : . #

Total comments: 2

Patch Set 10 : simplify BoundsChecker #

Total comments: 2

Patch Set 11 : #

Patch Set 12 : rebase #

Patch Set 13 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+587 lines, -15 lines) Patch
M mojo/mojo_public.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -1 line 0 comments Download
M mojo/public/cpp/bindings/lib/array_internal.h View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +50 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/array_internal.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +12 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/bindings_serialization.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +21 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/bindings_serialization.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +38 lines, -5 lines 0 comments Download
A mojo/public/cpp/bindings/lib/bounds_checker.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +64 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/bounds_checker.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +77 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/message.cc View 2 chunks +2 lines, -6 lines 0 comments Download
M mojo/public/cpp/bindings/message.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/string.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/bounds_checker_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +209 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +45 lines, -2 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +34 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (0 generated)
yzshen1
Hi, Darin and Tom. Would you please take a look? Thanks! Things that are not ...
6 years, 7 months ago (2014-05-22 06:51:46 UTC) #1
Tom Sepez
https://codereview.chromium.org/289333002/diff/110001/mojo/public/cpp/bindings/lib/bindings_serialization.cc File mojo/public/cpp/bindings/lib/bindings_serialization.cc (right): https://codereview.chromium.org/289333002/diff/110001/mojo/public/cpp/bindings/lib/bindings_serialization.cc#newcode108 mojo/public/cpp/bindings/lib/bindings_serialization.cc:108: // Currently our binding code cannot handle structs of ...
6 years, 7 months ago (2014-05-22 19:39:20 UTC) #2
yzshen1
Thanks, Tom! PTAL https://codereview.chromium.org/289333002/diff/110001/mojo/public/cpp/bindings/lib/bindings_serialization.cc File mojo/public/cpp/bindings/lib/bindings_serialization.cc (right): https://codereview.chromium.org/289333002/diff/110001/mojo/public/cpp/bindings/lib/bindings_serialization.cc#newcode108 mojo/public/cpp/bindings/lib/bindings_serialization.cc:108: // Currently our binding code cannot ...
6 years, 7 months ago (2014-05-22 20:56:22 UTC) #3
Tom Sepez
On 2014/05/22 19:39:21, Tom Sepez wrote: > > I think you'll want a vector of ...
6 years, 7 months ago (2014-05-22 21:03:05 UTC) #4
Tom Sepez
Few more thoughts ... https://codereview.chromium.org/289333002/diff/130001/mojo/public/cpp/bindings/lib/bounds_checker.cc File mojo/public/cpp/bindings/lib/bounds_checker.cc (right): https://codereview.chromium.org/289333002/diff/130001/mojo/public/cpp/bindings/lib/bounds_checker.cc#newcode30 mojo/public/cpp/bindings/lib/bounds_checker.cc:30: } maybe in debug builds ...
6 years, 7 months ago (2014-05-23 18:18:34 UTC) #5
Tom Sepez
https://codereview.chromium.org/289333002/diff/130001/mojo/public/cpp/bindings/lib/bounds_checker.cc File mojo/public/cpp/bindings/lib/bounds_checker.cc (right): https://codereview.chromium.org/289333002/diff/130001/mojo/public/cpp/bindings/lib/bounds_checker.cc#newcode116 mojo/public/cpp/bindings/lib/bounds_checker.cc:116: claimed_ranges_.insert(pos, pair, pair + 2); this could be really ...
6 years, 7 months ago (2014-05-23 18:32:34 UTC) #6
yzshen1
Thanks, Tom! PTAL https://codereview.chromium.org/289333002/diff/130001/mojo/public/cpp/bindings/lib/bounds_checker.cc File mojo/public/cpp/bindings/lib/bounds_checker.cc (right): https://codereview.chromium.org/289333002/diff/130001/mojo/public/cpp/bindings/lib/bounds_checker.cc#newcode30 mojo/public/cpp/bindings/lib/bounds_checker.cc:30: } On 2014/05/23 18:18:35, Tom Sepez ...
6 years, 7 months ago (2014-05-23 20:04:06 UTC) #7
yzshen1
Out of curiosity, I compared the performance of home-made binary search and std::upper_bound (i.e., the ...
6 years, 7 months ago (2014-05-23 22:29:10 UTC) #8
Tom Sepez
> I think this should be okay, because in most cases: > - |claimed_ranges_| is ...
6 years, 7 months ago (2014-05-23 23:09:19 UTC) #9
chromium-reviews
Thanks Tom! Please see inlined comments. Darin: would you please take a look? Thanks! On ...
6 years, 7 months ago (2014-05-26 08:34:05 UTC) #10
darin (slow to review)
https://codereview.chromium.org/289333002/diff/150001/mojo/public/cpp/bindings/lib/bounds_checker.h File mojo/public/cpp/bindings/lib/bounds_checker.h (right): https://codereview.chromium.org/289333002/diff/150001/mojo/public/cpp/bindings/lib/bounds_checker.h#newcode20 mojo/public/cpp/bindings/lib/bounds_checker.h:20: // BoundsChecker is used to validate object sizes, pointers ...
6 years, 7 months ago (2014-05-26 19:17:46 UTC) #11
yzshen1
Thanks, Darin! https://codereview.chromium.org/289333002/diff/150001/mojo/public/cpp/bindings/lib/bounds_checker.h File mojo/public/cpp/bindings/lib/bounds_checker.h (right): https://codereview.chromium.org/289333002/diff/150001/mojo/public/cpp/bindings/lib/bounds_checker.h#newcode20 mojo/public/cpp/bindings/lib/bounds_checker.h:20: // BoundsChecker is used to validate object ...
6 years, 7 months ago (2014-05-26 21:30:56 UTC) #12
darin (slow to review)
On 2014/05/26 21:30:56, yzshen1 wrote: > Thanks, Darin! > > https://codereview.chromium.org/289333002/diff/150001/mojo/public/cpp/bindings/lib/bounds_checker.h > File mojo/public/cpp/bindings/lib/bounds_checker.h (right): ...
6 years, 7 months ago (2014-05-27 17:29:25 UTC) #13
Tom Sepez
> I would probably try the stricter, simpler approach until we learn that we > ...
6 years, 7 months ago (2014-05-27 17:50:36 UTC) #14
yzshen1
Hi, Darin and Tom. I have updated the BoundsChecker and tests. PTAL. Thanks!
6 years, 6 months ago (2014-05-28 08:10:37 UTC) #15
Tom Sepez
LGTM https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h File mojo/public/cpp/bindings/lib/bounds_checker.h (right): https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h#newcode45 mojo/public/cpp/bindings/lib/bounds_checker.h:45: bool IsWithinUnclaimedRange(const void* position, uint32_t num_bytes) const; nit: ...
6 years, 6 months ago (2014-05-28 17:12:51 UTC) #16
yzshen1
https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h File mojo/public/cpp/bindings/lib/bounds_checker.h (right): https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h#newcode45 mojo/public/cpp/bindings/lib/bounds_checker.h:45: bool IsWithinUnclaimedRange(const void* position, uint32_t num_bytes) const; On 2014/05/28 ...
6 years, 6 months ago (2014-05-28 17:27:51 UTC) #17
darin (slow to review)
On 2014/05/28 17:27:51, yzshen1 wrote: > https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h > File mojo/public/cpp/bindings/lib/bounds_checker.h (right): > > https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h#newcode45 > ...
6 years, 6 months ago (2014-05-28 19:50:12 UTC) #18
darin (slow to review)
On 2014/05/28 19:50:12, darin wrote: > On 2014/05/28 17:27:51, yzshen1 wrote: > > > https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h ...
6 years, 6 months ago (2014-05-28 19:56:29 UTC) #19
yzshen1
On 2014/05/28 19:50:12, darin wrote: > On 2014/05/28 17:27:51, yzshen1 wrote: > > > https://codereview.chromium.org/289333002/diff/170001/mojo/public/cpp/bindings/lib/bounds_checker.h ...
6 years, 6 months ago (2014-05-28 20:08:08 UTC) #20
yzshen1
On 2014/05/28 19:56:29, darin wrote: > On 2014/05/28 19:50:12, darin wrote: > > On 2014/05/28 ...
6 years, 6 months ago (2014-05-28 20:12:09 UTC) #21
yzshen1
Done. I changed quite some comments to go with this renaming. Please take another look. ...
6 years, 6 months ago (2014-05-28 20:49:29 UTC) #22
Tom Sepez
Still LGTM.
6 years, 6 months ago (2014-05-28 21:03:48 UTC) #23
darin (slow to review)
LGTM
6 years, 6 months ago (2014-05-28 23:47:20 UTC) #24
yzshen1
The CQ bit was checked by yzshen@chromium.org
6 years, 6 months ago (2014-05-30 20:00:32 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yzshen@chromium.org/289333002/230001
6 years, 6 months ago (2014-05-30 20:05:34 UTC) #26
commit-bot: I haz the power
6 years, 6 months ago (2014-05-31 04:07:06 UTC) #27
Message was sent while issue was closed.
Change committed as 274005

Powered by Google App Engine
This is Rietveld 408576698