Commit 14f0fd05 authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

LZMA: Unconditionally flush output files after unmapping.

BUG=933975,1069116
R=etiennep@chromium.org

Change-Id: I294eba49176369fe06f541e681b7fee84aba48bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146548
Commit-Queue: Greg Thompson <grt@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: default avatarEtienne Pierre-Doray <etiennep@chromium.org>
Auto-Submit: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758876}
parent ab93ef72
......@@ -18,7 +18,6 @@
#include "base/logging.h"
#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
extern "C" {
#include "third_party/lzma_sdk/7z.h"
......@@ -370,12 +369,12 @@ UnPackStatus LzmaUtilImpl::UnPack(const base::FilePath& location,
// Unmap the target file from the process's address space.
mapped_file.reset();
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();
// Flush to avoid odd behavior, such as the bug in Windows 7 through
// Windows 10 1809 for PE files described in
// https://randomascii.wordpress.com/2018/02/25/compiler-bug-linker-bug-windows-kernel-bug/.
// We've also observed oddly empty files on other Windows versions, so
// this is unconditional.
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