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

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

Issue 494943004: Mojo C++ bindings: better log messages for some validation errors at the receiver side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | « no previous file | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/array_internal.h
diff --git a/mojo/public/cpp/bindings/lib/array_internal.h b/mojo/public/cpp/bindings/lib/array_internal.h
index 6b0baa0f07ce8e27fc5ebe2a5278bfd48fb7a971..b512295e40314bf31beaa63a33d92202aa1eb8c9 100644
--- a/mojo/public/cpp/bindings/lib/array_internal.h
+++ b/mojo/public/cpp/bindings/lib/array_internal.h
@@ -216,7 +216,11 @@ struct ArraySerializationHelper<Handle, true> {
for (uint32_t i = 0; i < header->num_elements; ++i) {
if (!element_is_nullable &&
elements[i].value() == kEncodedInvalidHandleValue) {
- ReportValidationError(VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE);
+ ReportValidationError(
+ VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
+ MakeMessageWithArrayIndex(
+ "invalid handle in array expecting valid handles",
+ header->num_elements, i).c_str());
return false;
}
if (!bounds_checker->ClaimHandle(elements[i])) {
@@ -280,7 +284,11 @@ struct ArraySerializationHelper<P*, false> {
BoundsChecker* bounds_checker) {
for (uint32_t i = 0; i < header->num_elements; ++i) {
if (!element_is_nullable && !elements[i].offset) {
- ReportValidationError(VALIDATION_ERROR_UNEXPECTED_NULL_POINTER);
+ ReportValidationError(
+ VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
+ MakeMessageWithArrayIndex(
+ "null in array expecting valid pointers",
+ header->num_elements, i).c_str());
return false;
}
if (!ValidateEncodedPointer(&elements[i].offset)) {
@@ -356,7 +364,11 @@ class Array_Data {
}
if (Params::expected_num_elements != 0 &&
header->num_elements != Params::expected_num_elements) {
- ReportValidationError(VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER);
+ ReportValidationError(
+ VALIDATION_ERROR_UNEXPECTED_ARRAY_HEADER,
+ MakeMessageWithExpectedArraySize(
+ "fixed-size array has wrong number of elements",
+ header->num_elements, Params::expected_num_elements).c_str());
return false;
}
if (!bounds_checker->ClaimMemory(data, header->num_bytes)) {
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698