| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/public/cpp/bindings/lib/message_header_validator.h" | 5 #include "mojo/public/cpp/bindings/lib/message_header_validator.h" |
| 6 | 6 |
| 7 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" | 7 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" |
| 8 #include "mojo/public/cpp/bindings/lib/bounds_checker.h" | 8 #include "mojo/public/cpp/bindings/lib/bounds_checker.h" |
| 9 #include "mojo/public/cpp/bindings/lib/validation_errors.h" | 9 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 ((header->flags & kMessageExpectsResponse) || | 41 ((header->flags & kMessageExpectsResponse) || |
| 42 (header->flags & kMessageIsResponse))) { | 42 (header->flags & kMessageIsResponse))) { |
| 43 ReportValidationError(VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID); | 43 ReportValidationError(VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID); |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // These flags are mutually exclusive. | 47 // These flags are mutually exclusive. |
| 48 if ((header->flags & kMessageExpectsResponse) && | 48 if ((header->flags & kMessageExpectsResponse) && |
| 49 (header->flags & kMessageIsResponse)) { | 49 (header->flags & kMessageIsResponse)) { |
| 50 ReportValidationError( | 50 ReportValidationError( |
| 51 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINAION); | 51 VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION); |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 | 54 |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 MessageHeaderValidator::MessageHeaderValidator(MessageReceiver* sink) | 60 MessageHeaderValidator::MessageHeaderValidator(MessageReceiver* sink) |
| 61 : MessageFilter(sink) { | 61 : MessageFilter(sink) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (!IsValidMessageHeader(message->header())) | 74 if (!IsValidMessageHeader(message->header())) |
| 75 return false; | 75 return false; |
| 76 | 76 |
| 77 return sink_->Accept(message); | 77 return sink_->Accept(message); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace internal | 80 } // namespace internal |
| 81 } // namespace mojo | 81 } // namespace mojo |
| OLD | NEW |