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

Issue 1800753005: C++ bindings: A struct's Deserialize() now does validation before deserializing. (Closed)

Created:
4 years, 9 months ago by vardhan
Modified:
4 years, 8 months ago
Reviewers:
ukode, viettrungluu, qsr
CC:
mojo-reviews_chromium.org, gregsimon, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org, yzshen+mojopublicwatch_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

C++ bindings: A struct's Deserialize() now does validation before deserializing. * Consequently, |Deserialize()| now has a |buf_size| argument. BUG=#419 R=qsr@chromium.org, ukode@google.com, viettrungluu@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/bbe5f8b0feb702d18fda31aa86c9da59a4485a36

Patch Set 1 #

Total comments: 6

Patch Set 2 : Add |bytes_written| field Serialize(), DeserializeWithoutValidation(). Update consumers & tests. #

Patch Set 3 : oops, typos #

Total comments: 18

Patch Set 4 : Address comments. DeserializeWithoutValidation returns void, doesn't take in buf_size. #

Total comments: 16

Patch Set 5 : fix char* - >char bug in unittest. FixedBuffer can accept sizes that aren't 8 byte multiples. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+154 lines, -76 lines) Patch
M examples/serialization/main.cc View 1 chunk +1 line, -2 lines 0 comments Download
M mojo/public/cpp/bindings/lib/bindings_internal.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/fixed_buffer.h View 1 1 chunk +8 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/fixed_buffer.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M mojo/public/cpp/bindings/lib/validation_errors.h View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/buffer_unittest.cc View 1 2 3 4 1 chunk +8 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/serialization_api_unittest.cc View 1 2 3 4 3 chunks +64 lines, -3 lines 0 comments Download
M mojo/public/cpp/bindings/tests/union_unittest.cc View 1 2 3 4 1 chunk +1 line, -2 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl View 1 2 3 4 1 chunk +43 lines, -7 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl View 1 2 3 1 chunk +16 lines, -17 lines 0 comments Download
M services/authentication/accounts_db_manager.cc View 1 2 2 chunks +4 lines, -18 lines 0 comments Download
M services/url_response_disk_cache/url_response_disk_cache_db.cc View 1 2 3 2 chunks +4 lines, -25 lines 0 comments Download

Messages

Total messages: 21 (2 generated)
vardhan
PTAL
4 years, 9 months ago (2016-03-14 22:07:30 UTC) #1
viettrungluu
https://codereview.chromium.org/1800753005/diff/1/mojo/public/cpp/bindings/tests/union_unittest.cc File mojo/public/cpp/bindings/tests/union_unittest.cc (right): https://codereview.chromium.org/1800753005/diff/1/mojo/public/cpp/bindings/tests/union_unittest.cc#newcode660 mojo/public/cpp/bindings/tests/union_unittest.cc:660: small_struct->Serialize(buf, sizeof(buf)); Does Serialize() tell you how much space ...
4 years, 9 months ago (2016-03-14 22:56:24 UTC) #2
vardhan
https://codereview.chromium.org/1800753005/diff/1/mojo/public/cpp/bindings/tests/union_unittest.cc File mojo/public/cpp/bindings/tests/union_unittest.cc (right): https://codereview.chromium.org/1800753005/diff/1/mojo/public/cpp/bindings/tests/union_unittest.cc#newcode660 mojo/public/cpp/bindings/tests/union_unittest.cc:660: small_struct->Serialize(buf, sizeof(buf)); On 2016/03/14 22:56:23, viettrungluu wrote: > Does ...
4 years, 9 months ago (2016-03-14 23:11:34 UTC) #3
viettrungluu
On 2016/03/14 23:11:34, vardhan wrote: > https://codereview.chromium.org/1800753005/diff/1/mojo/public/cpp/bindings/tests/union_unittest.cc > File mojo/public/cpp/bindings/tests/union_unittest.cc (right): > > https://codereview.chromium.org/1800753005/diff/1/mojo/public/cpp/bindings/tests/union_unittest.cc#newcode660 > ...
4 years, 9 months ago (2016-03-14 23:37:31 UTC) #4
qsr
Could you update services/url_response_disk_cache/url_response_disk_cache_db.cc to use this?
4 years, 9 months ago (2016-03-16 08:36:53 UTC) #5
vardhan
(Oops, i replied to the email instead of on the codereview tool, so duplicating it ...
4 years, 9 months ago (2016-03-16 19:42:15 UTC) #6
vardhan
On 2016/03/16 08:36:53, qsr wrote: > Could you update services/url_response_disk_cache/url_response_disk_cache_db.cc > to use this? That's ...
4 years, 9 months ago (2016-03-16 19:43:04 UTC) #7
viettrungluu
On 2016/03/16 19:42:15, vardhan wrote: > (Oops, i replied to the email instead of on ...
4 years, 9 months ago (2016-03-16 23:08:23 UTC) #8
vardhan
PTAL cc: ukode@, qsr@ to CR their affected files.
4 years, 9 months ago (2016-03-23 00:47:20 UTC) #10
qsr
https://codereview.chromium.org/1800753005/diff/40001/services/url_response_disk_cache/url_response_disk_cache_db.cc File services/url_response_disk_cache/url_response_disk_cache_db.cc (right): https://codereview.chromium.org/1800753005/diff/40001/services/url_response_disk_cache/url_response_disk_cache_db.cc#newcode31 services/url_response_disk_cache/url_response_disk_cache_db.cc:31: size_t size = GetSerializedSize_(*input); Is it expected that I ...
4 years, 9 months ago (2016-03-23 08:14:37 UTC) #11
viettrungluu
https://codereview.chromium.org/1800753005/diff/40001/mojo/public/cpp/bindings/tests/serialization_api_unittest.cc File mojo/public/cpp/bindings/tests/serialization_api_unittest.cc (right): https://codereview.chromium.org/1800753005/diff/40001/mojo/public/cpp/bindings/tests/serialization_api_unittest.cc#newcode43 mojo/public/cpp/bindings/tests/serialization_api_unittest.cc:43: auto deserialize_ret = out_val.Deserialize(bytes.data(), bytes.size()); You may as well ...
4 years, 9 months ago (2016-03-23 17:43:53 UTC) #12
vardhan
ptal https://codereview.chromium.org/1800753005/diff/40001/mojo/public/cpp/bindings/tests/serialization_api_unittest.cc File mojo/public/cpp/bindings/tests/serialization_api_unittest.cc (right): https://codereview.chromium.org/1800753005/diff/40001/mojo/public/cpp/bindings/tests/serialization_api_unittest.cc#newcode43 mojo/public/cpp/bindings/tests/serialization_api_unittest.cc:43: auto deserialize_ret = out_val.Deserialize(bytes.data(), bytes.size()); On 2016/03/23 17:43:53, ...
4 years, 9 months ago (2016-03-23 23:28:43 UTC) #13
qsr
url_response_disk_cache_db.cc LGTM.
4 years, 9 months ago (2016-03-24 08:35:05 UTC) #14
ukode
lgtm For accountdb_manager.cc, lgtm.
4 years, 9 months ago (2016-03-25 21:13:36 UTC) #15
vardhan
ping viettrungluu@
4 years, 8 months ago (2016-03-29 20:28:51 UTC) #16
viettrungluu
https://codereview.chromium.org/1800753005/diff/60001/mojo/public/cpp/bindings/lib/bindings_internal.h File mojo/public/cpp/bindings/lib/bindings_internal.h (right): https://codereview.chromium.org/1800753005/diff/60001/mojo/public/cpp/bindings/lib/bindings_internal.h#newcode101 mojo/public/cpp/bindings/lib/bindings_internal.h:101: // TODO(vardhan): Should RemoveStructPtr<> be internal-only? Should be /the/ ...
4 years, 8 months ago (2016-03-30 17:49:02 UTC) #17
vardhan
ptal https://codereview.chromium.org/1800753005/diff/60001/mojo/public/cpp/bindings/lib/bindings_internal.h File mojo/public/cpp/bindings/lib/bindings_internal.h (right): https://codereview.chromium.org/1800753005/diff/60001/mojo/public/cpp/bindings/lib/bindings_internal.h#newcode101 mojo/public/cpp/bindings/lib/bindings_internal.h:101: // TODO(vardhan): Should RemoveStructPtr<> be internal-only? Should be ...
4 years, 8 months ago (2016-03-30 22:49:07 UTC) #18
viettrungluu
lgtm
4 years, 8 months ago (2016-03-31 17:36:55 UTC) #19
vardhan
4 years, 8 months ago (2016-03-31 20:03:43 UTC) #21
Message was sent while issue was closed.
Committed patchset #5 (id:80001) manually as
bbe5f8b0feb702d18fda31aa86c9da59a4485a36 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698