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

Unified Diff: mojo/public/cpp/bindings/lib/map_data_internal.h

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
« no previous file with comments | « mojo/public/cpp/bindings/lib/interface_ptr_state.h ('k') | mojo/public/cpp/bindings/lib/message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/map_data_internal.h
diff --git a/mojo/public/cpp/bindings/lib/map_data_internal.h b/mojo/public/cpp/bindings/lib/map_data_internal.h
index 0a4fc73ac6cb29c6762212fd39663f18d78df663..e2633331e0278f719fe2e6e308c9672fc20679da 100644
--- a/mojo/public/cpp/bindings/lib/map_data_internal.h
+++ b/mojo/public/cpp/bindings/lib/map_data_internal.h
@@ -25,48 +25,53 @@ class Map_Data {
// |validate_params| must have non-null |key_validate_params| and
// |element_validate_params| members.
static bool Validate(const void* data,
- BoundsChecker* bounds_checker,
+ ValidationContext* validation_context,
const ContainerValidateParams* validate_params) {
if (!data)
return true;
- if (!ValidateStructHeaderAndClaimMemory(data, bounds_checker))
+ if (!ValidateStructHeaderAndClaimMemory(data, validation_context))
return false;
const Map_Data* object = static_cast<const Map_Data*>(data);
if (object->header_.num_bytes != sizeof(Map_Data) ||
object->header_.version != 0) {
- ReportValidationError(VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER);
+ ReportValidationError(validation_context,
+ VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER);
return false;
}
if (!ValidateEncodedPointer(&object->keys.offset)) {
- ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER);
+ ReportValidationError(validation_context,
+ VALIDATION_ERROR_ILLEGAL_POINTER);
return false;
}
if (!object->keys.offset) {
- ReportValidationError(VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
+ ReportValidationError(validation_context,
+ VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null key array in map struct");
return false;
}
if (!Array_Data<Key>::Validate(DecodePointerRaw(&object->keys.offset),
- bounds_checker,
+ validation_context,
validate_params->key_validate_params)) {
return false;
}
if (!ValidateEncodedPointer(&object->values.offset)) {
- ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER);
+ ReportValidationError(validation_context,
+ VALIDATION_ERROR_ILLEGAL_POINTER);
return false;
}
if (!object->values.offset) {
- ReportValidationError(VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
+ ReportValidationError(validation_context,
+ VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null value array in map struct");
return false;
}
if (!Array_Data<Value>::Validate(
DecodePointerRaw(&object->values.offset),
- bounds_checker, validate_params->element_validate_params)) {
+ validation_context, validate_params->element_validate_params)) {
return false;
}
@@ -75,7 +80,8 @@ class Map_Data {
const ArrayHeader* value_header = static_cast<const ArrayHeader*>(
DecodePointerRaw(&object->values.offset));
if (key_header->num_elements != value_header->num_elements) {
- ReportValidationError(VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP);
+ ReportValidationError(validation_context,
+ VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP);
return false;
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/interface_ptr_state.h ('k') | mojo/public/cpp/bindings/lib/message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698