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

Unified Diff: tools/win/split_link/split_link.cc

Issue 15180002: Fix crash in super splity linker, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« 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: tools/win/split_link/split_link.cc
diff --git a/tools/win/split_link/split_link.cc b/tools/win/split_link/split_link.cc
index 639f1c55eac771b38db5f146c3e910206c390c9a..dab06188c309555e3e7de08fd65155c10b25e3d3 100644
--- a/tools/win/split_link/split_link.cc
+++ b/tools/win/split_link/split_link.cc
@@ -182,7 +182,7 @@ static void Fallback() {
static unsigned char* SlurpFile(const wchar_t* path, size_t* length) {
HANDLE file = CreateFile(
- path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL);
+ path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (file == INVALID_HANDLE_VALUE)
Fallback(L"couldn't open file");
LARGE_INTEGER file_size;
@@ -190,7 +190,8 @@ static unsigned char* SlurpFile(const wchar_t* path, size_t* length) {
Fallback(L"couldn't get file size");
*length = static_cast<size_t>(file_size.QuadPart);
unsigned char* buffer = static_cast<unsigned char*>(malloc(*length));
- if (!ReadFile(file, buffer, *length, NULL, NULL))
+ DWORD bytes_read = 0;
+ if (!ReadFile(file, buffer, *length, &bytes_read, NULL))
Fallback(L"couldn't read file");
return buffer;
}
« 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