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

Unified Diff: mojo/edk/system/transport_data.cc

Issue 830593003: Update mojo sdk to rev 9fbbc4f0fef1187312316c0ed992342474e139f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cherry-pick mojo 9d3b8dd17f12d20035a14737fdc38dd926890ff8 Created 5 years, 11 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 | « mojo/edk/system/transport_data.h ('k') | mojo/edk/system/unique_identifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/transport_data.cc
diff --git a/mojo/edk/system/transport_data.cc b/mojo/edk/system/transport_data.cc
index c80a98aca39ab34ca733b3eaf9278c555c843557..d388151bd49fd7ab21f989f8eac3966a0c576144 100644
--- a/mojo/edk/system/transport_data.cc
+++ b/mojo/edk/system/transport_data.cc
@@ -191,15 +191,17 @@ TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers,
// |dispatchers_| will be destroyed as it goes out of scope.
}
-#if defined(OS_POSIX)
TransportData::TransportData(
embedder::ScopedPlatformHandleVectorPtr platform_handles)
: buffer_size_(sizeof(Header)), platform_handles_(platform_handles.Pass()) {
buffer_.reset(static_cast<char*>(
base::AlignedAlloc(buffer_size_, MessageInTransit::kMessageAlignment)));
memset(buffer_.get(), 0, buffer_size_);
+
+ Header* header = reinterpret_cast<Header*>(buffer_.get());
+ header->num_platform_handles =
+ static_cast<uint32_t>(platform_handles_->size());
}
-#endif // defined(OS_POSIX)
TransportData::~TransportData() {
}
@@ -221,15 +223,6 @@ const char* TransportData::ValidateBuffer(
const Header* header = static_cast<const Header*>(buffer);
const size_t num_handles = header->num_handles;
-#if !defined(OS_POSIX)
- // On POSIX, we send control messages with platform handles (but no handles)
- // attached (see the comments for
- // |TransportData(embedder::ScopedPlatformHandleVectorPtr)|. (This check isn't
- // important security-wise anyway.)
- if (num_handles == 0)
- return "Message has no handles attached, but secondary buffer present";
-#endif
-
// Sanity-check |num_handles| (before multiplying it against anything).
if (num_handles > GetConfiguration().max_message_num_handles)
return "Message handle payload too large";
@@ -244,9 +237,9 @@ const char* TransportData::ValidateBuffer(
"present";
}
} else {
- // |num_handles| has already been validated, so the multiplication is okay.
if (header->num_platform_handles >
- num_handles * kMaxSerializedDispatcherPlatformHandles)
+ GetConfiguration().max_message_num_handles *
+ kMaxSerializedDispatcherPlatformHandles)
return "Message has too many platform handles attached";
static const char kInvalidPlatformHandleTableOffset[] =
« no previous file with comments | « mojo/edk/system/transport_data.h ('k') | mojo/edk/system/unique_identifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698