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

Unified Diff: base/shared_memory_nacl.cc

Issue 11446048: The correct type for the size of a chunk of memory is size_t. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 | « base/shared_memory_android.cc ('k') | base/shared_memory_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/shared_memory_nacl.cc
===================================================================
--- base/shared_memory_nacl.cc (revision 175576)
+++ base/shared_memory_nacl.cc (working copy)
@@ -10,6 +10,8 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <limits>
+
#include "base/logging.h"
namespace base {
@@ -64,7 +66,7 @@
DPLOG(ERROR) << "close";
}
-bool SharedMemory::CreateAndMapAnonymous(uint32 size) {
+bool SharedMemory::CreateAndMapAnonymous(size_t size) {
// Untrusted code can't create descriptors or handles.
return false;
}
@@ -82,10 +84,13 @@
return false;
}
-bool SharedMemory::Map(uint32 bytes) {
+bool SharedMemory::Map(size_t bytes) {
if (mapped_file_ == -1)
return false;
+ if (bytes > static_cast<size_t>(std::numeric_limits<int>::max()))
+ return false;
+
memory_ = mmap(NULL, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE),
MAP_SHARED, mapped_file_, 0);
« no previous file with comments | « base/shared_memory_android.cc ('k') | base/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698