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

Unified Diff: mojo/public/cpp/bindings/message.h

Issue 289333002: Mojo cpp bindings: validation logic for incoming messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/message.h
diff --git a/mojo/public/cpp/bindings/message.h b/mojo/public/cpp/bindings/message.h
index e6c42058ac23d34c5183d1ccfc45e9e2fcb5e496..5ed0586fb88e006f0e67055f9c93d5fd7b282176 100644
--- a/mojo/public/cpp/bindings/message.h
+++ b/mojo/public/cpp/bindings/message.h
@@ -63,6 +63,10 @@ class Message {
uint8_t* mutable_payload() {
return reinterpret_cast<uint8_t*>(data_) + data_->header.num_bytes;
}
+ uint32_t payload_num_bytes() const {
+ assert(data_num_bytes_ >= data_->header.num_bytes);
+ return data_num_bytes_ - data_->header.num_bytes;
+ }
// Access the handles.
const std::vector<Handle>* handles() const { return &handles_; }

Powered by Google App Engine
This is Rietveld 408576698