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

Issue 2163793002: C bindings: Implement _Validate(), and some pre-requisites (Closed)

Created:
4 years, 5 months ago by vardhan
Modified:
4 years, 4 months ago
Reviewers:
viettrungluu
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:
git@github.com:domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

C bindings: Implement _Validate(), and some pre-requisites This patchset passes the conformance & bounds checking validation tests, the same ones that the C++ version goes through. Pre-req to accomodate getting validation to work: - For structs, code-generate version->expected struct size mapping, used for validation. - For arrays, code-generate size of a single element, in bits. Used for array size validation. - For maps, have a separate type descriptor type, just so we can check that the 2 contained arrays are the same size. Validation involves maintaining a ValidationContext struct, which throughout validation is updated to containing the expected next handle offset and next pointer offset. This CL also factors out some common validation data/golden file reading code between C/C++. R=viettrungluu@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/15fbc30f08a51f9ead881822c9572fbe013aecba

Patch Set 1 #

Patch Set 2 : oops: forgot closing '}' in code generator #

Patch Set 3 : separated out map & interface generator fixes out in another CL #

Patch Set 4 : share common validation utility code between c/c++ tests. remove generating __HasResponse for inte… #

Total comments: 22

Patch Set 5 : address comments #

Patch Set 6 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1047 lines, -131 lines) Patch
M mojo/public/c/bindings/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/c/bindings/array.h View 1 chunk +19 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/lib/array.c View 2 chunks +74 lines, -0 lines 0 comments Download
A mojo/public/c/bindings/lib/map.c View 1 chunk +36 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/lib/message.c View 1 2 3 4 2 chunks +28 lines, -3 lines 0 comments Download
M mojo/public/c/bindings/lib/struct.c View 2 chunks +68 lines, -1 line 0 comments Download
M mojo/public/c/bindings/lib/type_descriptor.h View 1 2 3 4 6 chunks +34 lines, -10 lines 0 comments Download
M mojo/public/c/bindings/lib/type_descriptor.c View 1 2 3 4 5 6 chunks +135 lines, -4 lines 0 comments Download
M mojo/public/c/bindings/lib/union.c View 1 chunk +34 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/lib/util.h View 1 2 3 1 chunk +15 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/map.h View 2 chunks +10 lines, -1 line 0 comments Download
M mojo/public/c/bindings/message.h View 1 chunk +17 lines, -1 line 0 comments Download
M mojo/public/c/bindings/struct.h View 3 chunks +22 lines, -3 lines 0 comments Download
M mojo/public/c/bindings/tests/BUILD.gn View 1 2 3 2 chunks +3 lines, -0 lines 0 comments Download
A mojo/public/c/bindings/tests/validation_unittest.cc View 1 2 3 1 chunk +269 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/union.h View 1 chunk +20 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/BUILD.gn View 1 2 3 4 5 3 chunks +23 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/validation_unittest.cc View 1 2 3 2 chunks +12 lines, -96 lines 0 comments Download
A mojo/public/cpp/bindings/tests/validation_util.h View 1 2 3 4 1 chunk +38 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/validation_util.cc View 1 2 3 1 chunk +107 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/mojom_tool/bin/linux64/generators/c.sha1 View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/tools/bindings/mojom_tool/bin/mac64/generators/c.sha1 View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M mojom/generators/c/cgen/header.go View 2 chunks +2 lines, -2 lines 0 comments Download
M mojom/generators/c/cgen/type_table.go View 1 2 3 4 8 chunks +36 lines, -3 lines 0 comments Download
M mojom/generators/c/cgen/type_translation.go View 3 chunks +16 lines, -1 line 0 comments Download
M mojom/generators/c/templates/interface.tmpl.go View 1 2 3 1 chunk +0 lines, -4 lines 0 comments Download
M mojom/generators/c/templates/struct.tmpl.go View 1 2 2 chunks +17 lines, -0 lines 0 comments Download
M mojom/generators/c/templates/type_table.tmpl.go View 1 2 2 chunks +9 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 9 (2 generated)
vardhan
PTAL Sorry about the large code size -- It involves some small things I had ...
4 years, 5 months ago (2016-07-19 20:28:00 UTC) #1
vardhan
ping. (i moved out some of generator changes into a separate CL to simplify this ...
4 years, 4 months ago (2016-07-26 20:13:40 UTC) #3
viettrungluu
Just minor things. https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/message.c File mojo/public/c/bindings/lib/message.c (right): https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/message.c#newcode16 mojo/public/c/bindings/lib/message.c:16: if (in_buf_size < sizeof(struct MojomStructHeader) || ...
4 years, 4 months ago (2016-07-28 23:03:01 UTC) #4
vardhan
PTAL https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/message.c File mojo/public/c/bindings/lib/message.c (right): https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/message.c#newcode16 mojo/public/c/bindings/lib/message.c:16: if (in_buf_size < sizeof(struct MojomStructHeader) || On 2016/07/28 ...
4 years, 4 months ago (2016-07-29 21:29:22 UTC) #5
viettrungluu
lgtm otherwise https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/type_descriptor.c File mojo/public/c/bindings/lib/type_descriptor.c (right): https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/type_descriptor.c#newcode286 mojo/public/c/bindings/lib/type_descriptor.c:286: if (pointer->offset >= UINT32_MAX || pointer->offset > ...
4 years, 4 months ago (2016-08-01 21:17:19 UTC) #6
vardhan
https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/type_descriptor.c File mojo/public/c/bindings/lib/type_descriptor.c (right): https://codereview.chromium.org/2163793002/diff/60001/mojo/public/c/bindings/lib/type_descriptor.c#newcode286 mojo/public/c/bindings/lib/type_descriptor.c:286: if (pointer->offset >= UINT32_MAX || pointer->offset > max_offset) On ...
4 years, 4 months ago (2016-08-01 22:18:17 UTC) #7
vardhan
4 years, 4 months ago (2016-08-01 22:18:44 UTC) #9
Message was sent while issue was closed.
Committed patchset #6 (id:100001) manually as
15fbc30f08a51f9ead881822c9572fbe013aecba (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698