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

Unified Diff: mojo/system/shared_buffer_dispatcher.cc

Issue 304303006: Mojo: Specify/check alignment of pointers more carefully. (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
« mojo/system/memory_unittest.cc ('K') | « mojo/system/message_pipe_dispatcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/shared_buffer_dispatcher.cc
diff --git a/mojo/system/shared_buffer_dispatcher.cc b/mojo/system/shared_buffer_dispatcher.cc
index 29f1de5675887561c940594cf7d469c5e35ebe96..841c6596ad4e09af67473884b1cc914c4895cec3 100644
--- a/mojo/system/shared_buffer_dispatcher.cc
+++ b/mojo/system/shared_buffer_dispatcher.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "mojo/public/c/system/macros.h"
#include "mojo/system/constants.h"
#include "mojo/system/memory.h"
#include "mojo/system/raw_shared_buffer.h"
@@ -149,10 +150,11 @@ MojoResult SharedBufferDispatcher::DuplicateBufferHandleImplNoLock(
lock().AssertAcquired();
if (options) {
// The |struct_size| field must be valid to read.
- if (!VerifyUserPointer<uint32_t>(&options->struct_size, 1))
+ if (!VerifyUserPointer<uint32_t>(&options->struct_size))
return MOJO_RESULT_INVALID_ARGUMENT;
// And then |options| must point to at least |options->struct_size| bytes.
- if (!VerifyUserPointer<void>(options, options->struct_size))
+ if (!VerifyUserPointerWithSize<MOJO_ALIGNOF(int64_t)>(options,
+ options->struct_size))
return MOJO_RESULT_INVALID_ARGUMENT;
if (options->struct_size < sizeof(*options))
« mojo/system/memory_unittest.cc ('K') | « mojo/system/message_pipe_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698