Skip to content

Commit d916385

Browse files
authored
Removing an issue where two fuzzers used the same shared memory under windows
2 parents 92774a1 + 1d7fd7c commit d916385

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

libfuzzer-dotnet-windows.cc

100644100755
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#include <string>
1111
#include <tchar.h>
1212
#include <windows.h>
13+
#include <rpcdce.h>
14+
15+
#pragma comment(lib, "rpcrt4.lib")
1316

1417
#ifdef __cplusplus
1518
#define FUZZ_EXPORT extern "C" __declspec(dllexport)
@@ -136,7 +139,17 @@ FUZZ_EXPORT int __cdecl LLVMFuzzerInitialize(int *argc, char ***argv)
136139
die_sys("CreatePipe() failed");
137140
}
138141

139-
TCHAR sharedMemName[] = TEXT("LIBFUZZER_DOTNET_SHMEM");
142+
UUID uuid;
143+
if (RPC_S_OK != UuidCreate(&uuid))
144+
{
145+
die("Could not create an UUID");
146+
}
147+
TCHAR *sharedMemName;
148+
if (RPC_S_OK != UuidToStringA(&uuid, (unsigned char **)&sharedMemName))
149+
{
150+
die("Could not convert UUID to a string\n");
151+
}
152+
140153
hMemFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, MAP_SIZE + DATA_SIZE, sharedMemName);
141154
if (hMemFile == NULL)
142155
{

0 commit comments

Comments
 (0)