Index: base/shared_memory_win.cc |
=================================================================== |
--- base/shared_memory_win.cc (revision 175576) |
+++ base/shared_memory_win.cc (working copy) |
@@ -70,7 +70,7 @@ |
::CloseHandle(handle); |
} |
-bool SharedMemory::CreateAndMapAnonymous(uint32 size) { |
+bool SharedMemory::CreateAndMapAnonymous(size_t size) { |
return CreateAnonymous(size) && Map(size); |
} |
@@ -80,6 +80,9 @@ |
if (options.size == 0) |
return false; |
+ if (options.size > static_cast<size_t>(std::numeric_limits<int>::max())) |
+ return false; |
+ |
// NaCl's memory allocator requires 0mod64K alignment and size for |
// shared memory objects. To allow passing shared memory to NaCl, |
// therefore we round the size actually created to the nearest 64K unit. |
@@ -131,10 +134,13 @@ |
return false; |
} |
-bool SharedMemory::Map(uint32 bytes) { |
+bool SharedMemory::Map(size_t bytes) { |
if (mapped_file_ == NULL) |
return false; |
+ if (bytes > static_cast<size_t>(std::numeric_limits<int>::max())) |
+ return false; |
+ |
memory_ = MapViewOfFile(mapped_file_, |
read_only_ ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS, 0, 0, bytes); |
if (memory_ != NULL) { |