Chromium Code Reviews| Index: third_party/zlib/google/zip_reader.cc |
| diff --git a/third_party/zlib/google/zip_reader.cc b/third_party/zlib/google/zip_reader.cc |
| index 59d96da14263cbfb88d2230e8250396152e8b85c..78b6e66d204d415593ac8d7120764e7d2c2a3459 100644 |
| --- a/third_party/zlib/google/zip_reader.cc |
| +++ b/third_party/zlib/google/zip_reader.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/message_loop/message_loop.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| +#include "base/thread_task_runner_handle.h" |
| #include "third_party/zlib/google/zip_internal.h" |
| #if defined(USE_SYSTEM_MINIZIP) |
| @@ -130,7 +131,8 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, |
| original_size_ = raw_file_info.uncompressed_size; |
| // Directory entries in zip files end with "/". |
| - is_directory_ = EndsWith(file_name_in_zip, "/", false); |
| + is_directory_ = base::EndsWith(file_name_in_zip, "/", |
| + base::CompareCase::INSENSITIVE_ASCII); |
|
viettrungluu
2016/01/28 21:32:46
The case insensitivity seems kind of stupid here (
|
| // Check the file name here for directory traversal issues. |
| is_unsafe_ = file_path_.ReferencesParent(); |
| @@ -144,7 +146,8 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip, |
| // We also consider that the file name is unsafe, if it's absolute. |
| // On Windows, IsAbsolute() returns false for paths starting with "/". |
| - if (file_path_.IsAbsolute() || StartsWithASCII(file_name_in_zip, "/", false)) |
| + if (file_path_.IsAbsolute() || |
| + base::StartsWithASCII(file_name_in_zip, "/", false)) |
| is_unsafe_ = true; |
| // Construct the last modified time. The timezone info is not present in |
| @@ -355,24 +358,26 @@ void ZipReader::ExtractCurrentEntryToFilePathAsync( |
| // If this is a directory, just create it and return. |
| if (current_entry_info()->is_directory()) { |
| if (base::CreateDirectory(output_file_path)) { |
| - base::MessageLoopProxy::current()->PostTask(FROM_HERE, success_callback); |
| + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| + success_callback); |
| } else { |
| DVLOG(1) << "Unzip failed: unable to create directory."; |
| - base::MessageLoopProxy::current()->PostTask(FROM_HERE, failure_callback); |
| + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| + failure_callback); |
| } |
| return; |
| } |
| if (unzOpenCurrentFile(zip_file_) != UNZ_OK) { |
| DVLOG(1) << "Unzip failed: unable to open current zip entry."; |
| - base::MessageLoopProxy::current()->PostTask(FROM_HERE, failure_callback); |
| + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, failure_callback); |
| return; |
| } |
| base::FilePath output_dir_path = output_file_path.DirName(); |
| if (!base::CreateDirectory(output_dir_path)) { |
| DVLOG(1) << "Unzip failed: unable to create containing directory."; |
| - base::MessageLoopProxy::current()->PostTask(FROM_HERE, failure_callback); |
| + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, failure_callback); |
| return; |
| } |
| @@ -382,7 +387,7 @@ void ZipReader::ExtractCurrentEntryToFilePathAsync( |
| if (!output_file.IsValid()) { |
| DVLOG(1) << "Unzip failed: unable to create platform file at " |
| << output_file_path.value(); |
| - base::MessageLoopProxy::current()->PostTask(FROM_HERE, failure_callback); |
| + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, failure_callback); |
| return; |
| } |