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

Unified Diff: base/memory/shared_memory_unittest.cc

Issue 2859843002: Add a GUID to base::SharedMemoryHandle. (Closed)
Patch Set: Check validity before writing handle. Created 3 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: base/memory/shared_memory_unittest.cc
diff --git a/base/memory/shared_memory_unittest.cc b/base/memory/shared_memory_unittest.cc
index 2cc7968e784470b78e98061f5cea95f92a583334..b054ae17d6b98e54b65a4371a08dd608c9913e10 100644
--- a/base/memory/shared_memory_unittest.cc
+++ b/base/memory/shared_memory_unittest.cc
@@ -19,6 +19,7 @@
#include "base/test/multiprocess_test.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
+#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
@@ -605,7 +606,8 @@ TEST(SharedMemoryTest, UnsafeImageSection) {
EXPECT_EQ(nullptr, shared_memory_open.memory());
SharedMemory shared_memory_handle_local(
- SharedMemoryHandle(section_handle.Take()), true);
+ SharedMemoryHandle(section_handle.Take(), UnguessableToken::Create()),
+ true);
EXPECT_FALSE(shared_memory_handle_local.Map(1));
EXPECT_EQ(nullptr, shared_memory_handle_local.memory());
@@ -620,7 +622,7 @@ TEST(SharedMemoryTest, UnsafeImageSection) {
::GetCurrentProcess(), shared_memory_handle_dummy.handle().GetHandle(),
::GetCurrentProcess(), &handle_no_query, FILE_MAP_READ, FALSE, 0));
SharedMemory shared_memory_handle_no_query(
- SharedMemoryHandle(handle_no_query), true);
+ SharedMemoryHandle(handle_no_query, UnguessableToken::Create()), true);
EXPECT_FALSE(shared_memory_handle_no_query.Map(1));
EXPECT_EQ(nullptr, shared_memory_handle_no_query.memory());
}

Powered by Google App Engine
This is Rietveld 408576698