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

Unified Diff: mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc

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/cpp/bindings/lib/pipe_control_message_handler.cc
diff --git a/mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc b/mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc
index ae952c503f2e33f31181c30363e56311e80491ee..56680c67ce0bccf19fa80bd38cd491396df3d414 100644
--- a/mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc
+++ b/mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc
@@ -5,6 +5,7 @@
#include "mojo/public/cpp/bindings/lib/pipe_control_message_handler.h"
#include "base/logging.h"
+#include "mojo/public/cpp/bindings/error.h"
#include "mojo/public/cpp/bindings/lib/message_builder.h"
#include "mojo/public/cpp/bindings/lib/pipe_control_message_handler_delegate.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
@@ -25,8 +26,8 @@ bool PipeControlMessageHandler::IsPipeControlMessage(const Message* message) {
return !IsValidInterfaceId(message->interface_id());
}
-bool PipeControlMessageHandler::Accept(Message* message) {
- if (!Validate(message))
+bool PipeControlMessageHandler::Accept(Message* message, Error* error) {
+ if (!Validate(message, error))
return false;
if (message->name() == pipe_control::kRunOrClosePipeMessageId)
@@ -36,10 +37,12 @@ bool PipeControlMessageHandler::Accept(Message* message) {
return false;
}
-bool PipeControlMessageHandler::Validate(const Message* message) {
+bool PipeControlMessageHandler::Validate(Message* message, Error* error) {
if (message->name() == pipe_control::kRunOrClosePipeMessageId) {
- if (!ValidateMessageIsRequestWithoutResponse(message))
+ if (!ValidateMessageIsRequestWithoutResponse(message)) {
+ *error = Error::ForBadMessage("Invalid pipe control request", message);
return false;
+ }
return ValidateMessagePayload<
pipe_control::internal::RunOrClosePipeMessageParams_Data>(message);
}

Powered by Google App Engine
This is Rietveld 408576698