Commit 80a9a91d authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Flush the output file after writing if it was mapped into memory.

This avoids an interesting bug in Windows as per the code comment.

BUG=933975
R=brucedawson@chromium.org

Change-Id: I11c18e9706520d1c52238914dfac87039b45138b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2058815
Auto-Submit: Greg Thompson <grt@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742301}
parent 1351a3c4
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
extern "C" { extern "C" {
#include "third_party/lzma_sdk/7z.h" #include "third_party/lzma_sdk/7z.h"
...@@ -345,6 +346,12 @@ UnPackStatus LzmaUtilImpl::UnPack(const base::FilePath& location, ...@@ -345,6 +346,12 @@ UnPackStatus LzmaUtilImpl::UnPack(const base::FilePath& location,
// Unmap the target file from the process's address space. // Unmap the target file from the process's address space.
mapped_file.reset(); mapped_file.reset();
last_folder_index = -1; last_folder_index = -1;
// Flush to avoid an interesting bug in Windows 7 through Windows 10
// 1809; see
// https://randomascii.wordpress.com/2018/02/25/compiler-bug-linker-bug-windows-kernel-bug/
// for details.
if (base::win::GetVersion() < base::win::Version::WIN10_RS5)
target_file.Flush();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment