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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl

Issue 2064903002: Mojo: Report bindings validation errors via MojoNotifyBadMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
index 1b4e5efa623bc2bd4201beadf6dc82234afc7d21..9ea62c3cbc067715e61c62f4c6cb88d019f91edf 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
@@ -7,12 +7,13 @@
}
// static
-bool {{class_name}}::Validate(const void* data,
- mojo::internal::BoundsChecker* bounds_checker) {
+bool {{class_name}}::Validate(
+ const void* data,
+ mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
- if (!ValidateStructHeaderAndClaimMemory(data, bounds_checker))
+ if (!ValidateStructHeaderAndClaimMemory(data, validation_context))
return false;
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
@@ -37,6 +38,7 @@ bool {{class_name}}::Validate(const void* data,
break;
ReportValidationError(
+ validation_context,
mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER);
return false;
}
@@ -44,6 +46,7 @@ bool {{class_name}}::Validate(const void* data,
} else if (object->header_.num_bytes <
kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) {
ReportValidationError(
+ validation_context,
mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER);
return false;
}

Powered by Google App Engine
This is Rietveld 408576698