diff options
author | zhaoqin <zhaoqin@chromium.org> | 2016-01-27 12:37:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-27 20:38:52 +0000 |
commit | e0f372c8b2b9a23e68d842271ecf601600396030 (patch) | |
tree | 68e799fbbfa24de2af44c15e6f9d35c6c65defd5 /testing/libfuzzer | |
parent | 77a444dc8136e3efb8542d6965b3e8f9439c5266 (diff) | |
download | chromium_src-e0f372c8b2b9a23e68d842271ecf601600396030.zip chromium_src-e0f372c8b2b9a23e68d842271ecf601600396030.tar.gz chromium_src-e0f372c8b2b9a23e68d842271ecf601600396030.tar.bz2 |
Fix pdfium_fuzzer build failure on Windows
- update ProgramPath to obtain program path on Windows
R=aizatsky@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1635793002
Cr-Commit-Position: refs/heads/master@{#371859}
Diffstat (limited to 'testing/libfuzzer')
-rw-r--r-- | testing/libfuzzer/fuzzers/pdfium_fuzzer.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc b/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc index 4b23b59..ef1ec53 100644 --- a/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc +++ b/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc @@ -9,7 +9,12 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> + +#ifdef _MSC_VER +#include <Windows.h> +#else #include <unistd.h> +#endif #include <list> #include <sstream> @@ -164,6 +169,14 @@ static void RenderPdf(const char* pBuf, size_t len) { } std::string ProgramPath() { +#ifdef _MSC_VER + wchar_t wpath[MAX_PATH]; + char path[MAX_PATH]; + DWORD res = GetModuleFileName(NULL, wpath, MAX_PATH); + assert(res != 0); + wcstombs(path, wpath, MAX_PATH); + return std::string(path, res); +#else char *path = new char[PATH_MAX + 1]; assert(path); ssize_t sz = readlink("/proc/self/exe", path, PATH_MAX); @@ -171,6 +184,7 @@ std::string ProgramPath() { std::string result(path, sz); delete[] path; return result; +#endif } struct TestCase { |