| Index: mojo/public/cpp/bindings/lib/validation_util.cc
|
| diff --git a/mojo/public/cpp/bindings/lib/validation_util.cc b/mojo/public/cpp/bindings/lib/validation_util.cc
|
| index 2268a159edd4ee4286ecf36a8e30808bbe10eec3..3051c1c2368eb9d3a213dec457823c725e6dd00b 100644
|
| --- a/mojo/public/cpp/bindings/lib/validation_util.cc
|
| +++ b/mojo/public/cpp/bindings/lib/validation_util.cc
|
| @@ -99,5 +99,40 @@ bool ValidateControlResponse(const Message* message) {
|
| return false;
|
| }
|
|
|
| +bool ValidateHandleNonNullable(const Handle& input, const char* error_message) {
|
| + if (input.value() != kEncodedInvalidHandleValue)
|
| + return true;
|
| +
|
| + ReportValidationError(VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
|
| + error_message);
|
| + return false;
|
| +}
|
| +
|
| +bool ValidateInterfaceIdNonNullable(InterfaceId input,
|
| + const char* error_message) {
|
| + if (IsValidInterfaceId(input))
|
| + return true;
|
| +
|
| + ReportValidationError(VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID,
|
| + error_message);
|
| + return false;
|
| +}
|
| +
|
| +bool ValidateHandle(const Handle& input, BoundsChecker* bounds_checker) {
|
| + if (bounds_checker->ClaimHandle(input))
|
| + return true;
|
| +
|
| + ReportValidationError(VALIDATION_ERROR_ILLEGAL_HANDLE);
|
| + return false;
|
| +}
|
| +
|
| +bool ValidateAssociatedInterfaceId(InterfaceId input) {
|
| + if (!IsMasterInterfaceId(input))
|
| + return true;
|
| +
|
| + ReportValidationError(VALIDATION_ERROR_ILLEGAL_INTERFACE_ID);
|
| + return false;
|
| +}
|
| +
|
| } // namespace internal
|
| } // namespace mojo
|
|
|