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

Issue 1509703002: Mojo C++ bindings: Fix bug: array<>, map<> should only initialize elements if they're not null when… (Closed)

Created:
5 years ago by vardhan
Modified:
5 years ago
Reviewers:
viettrungluu, jeffbrown
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

Mojo C++ bindings: Fix bug: array<>, map<> should only initialize elements if they're not null when Deserialize()ing. Simiarly, map's GetSerializedSize() tries to compute size of things that are null (leads to a seg fault). Fix this. R=viettrungluu@chromium.org, jeffbrown@google.com BUG=Fixes #578 Committed: https://chromium.googlesource.com/external/mojo/+/72eedddf746a2b62be78067a4c361cb172c71350

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+171 lines, -28 lines) Patch
M mojo/public/cpp/bindings/lib/array_serialization.h View 3 chunks +13 lines, -7 lines 4 comments Download
M mojo/public/cpp/bindings/lib/bindings_internal.h View 3 chunks +3 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/map_serialization.h View 1 chunk +3 lines, -1 line 2 comments Download
M mojo/public/cpp/bindings/struct_ptr.h View 2 chunks +3 lines, -4 lines 0 comments Download
M mojo/public/cpp/bindings/tests/array_unittest.cc View 2 chunks +91 lines, -14 lines 0 comments Download
M mojo/public/cpp/bindings/tests/map_unittest.cc View 5 chunks +58 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (1 generated)
viettrungluu
lgtm w/nits https://codereview.chromium.org/1509703002/diff/1/mojo/public/cpp/bindings/lib/array_serialization.h File mojo/public/cpp/bindings/lib/array_serialization.h (right): https://codereview.chromium.org/1509703002/diff/1/mojo/public/cpp/bindings/lib/array_serialization.h#newcode411 mojo/public/cpp/bindings/lib/array_serialization.h:411: if (input != nullptr) { nit: probably ...
5 years ago (2015-12-07 22:03:51 UTC) #1
vardhan
Committed patchset #1 (id:1) manually as 72eedddf746a2b62be78067a4c361cb172c71350 (presubmit successful).
5 years ago (2015-12-07 22:43:34 UTC) #3
vardhan
5 years ago (2015-12-07 22:48:31 UTC) #4
Message was sent while issue was closed.
(sorry, forgot to publish comments before submitting CL)

https://codereview.chromium.org/1509703002/diff/1/mojo/public/cpp/bindings/li...
File mojo/public/cpp/bindings/lib/array_serialization.h (right):

https://codereview.chromium.org/1509703002/diff/1/mojo/public/cpp/bindings/li...
mojo/public/cpp/bindings/lib/array_serialization.h:411: if (input != nullptr) {
On 2015/12/07 22:03:51, viettrungluu wrote:
> nit: probably "if (input)" should be fine and more idiomatic?

Done.

I was trying to be more explicit about what type |input| is (ie a  pointer), but
I realize now that that should be abstracted away, in the same way
|WrapperTraits<>::DataType| is abstracted away.

https://codereview.chromium.org/1509703002/diff/1/mojo/public/cpp/bindings/li...
mojo/public/cpp/bindings/lib/array_serialization.h:420: if (input != nullptr) {
On 2015/12/07 22:03:51, viettrungluu wrote:
> "

Done.

https://codereview.chromium.org/1509703002/diff/1/mojo/public/cpp/bindings/li...
File mojo/public/cpp/bindings/lib/map_serialization.h (right):

https://codereview.chromium.org/1509703002/diff/1/mojo/public/cpp/bindings/li...
mojo/public/cpp/bindings/lib/map_serialization.h:71: return !item.is_null()
On 2015/12/07 22:03:51, viettrungluu wrote:
> nit: Is S not testable? (I.e., would |return item ? ... : ...;| work instead?)

Done.
It's testable.  I was trying to be more explicit about |item| not being a
pointer, but now realize that should be abstracted away.

Powered by Google App Engine
This is Rietveld 408576698