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

Unified Diff: ppapi/proxy/video_decoder_resource_unittest.cc

Issue 2593873002: Fix use-after-free issue in VideoDecoderResourceTest. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/video_decoder_resource_unittest.cc
diff --git a/ppapi/proxy/video_decoder_resource_unittest.cc b/ppapi/proxy/video_decoder_resource_unittest.cc
index 80c28035d05cd21ea66f424f675a955fdec69b8f..8f80d7a71cefb650939d95cf22f6a112eb032c16 100644
--- a/ppapi/proxy/video_decoder_resource_unittest.cc
+++ b/ppapi/proxy/video_decoder_resource_unittest.cc
@@ -147,13 +147,15 @@ class VideoDecoderResourceTest : public PluginProxyTest {
&sink(), PpapiHostMsg_VideoDecoder_GetShm::ID, PP_OK, shm_msg_reply);
sink().AddFilter(&shm_msg_handler);
+ std::unique_ptr<base::SharedMemoryHandle> shm_handle;
+ std::unique_ptr<SerializedHandle> serialized_handle;
base::SharedMemory shm;
if (expected_shm_msg) {
shm.CreateAnonymous(kShmSize);
- base::SharedMemoryHandle shm_handle;
- shm.ShareToProcess(base::GetCurrentProcessHandle(), &shm_handle);
- SerializedHandle serialized_handle(shm_handle, kShmSize);
- shm_msg_handler.set_serialized_handle(&serialized_handle);
+ shm_handle.reset(new base::SharedMemoryHandle());
+ shm.ShareToProcess(base::GetCurrentProcessHandle(), shm_handle.get());
+ serialized_handle.reset(new SerializedHandle(*shm_handle, kShmSize));
+ shm_msg_handler.set_serialized_handle(serialized_handle.get());
}
memset(decode_buffer_, 0x55, kDecodeBufferSize);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698