Commit 105d38dd authored by grt's avatar grt Committed by Commit bot

Validate that zip entry filenames are UTF8.

BUG=462584

Review URL: https://codereview.chromium.org/1028243002

Cr-Commit-Position: refs/heads/master@{#322085}
parent 2cf99389
......@@ -4,6 +4,7 @@
#include "chrome/common/safe_browsing/zip_analyzer.h"
#include "base/i18n/streaming_utf8_validator.h"
#include "base/logging.h"
#include "base/macros.h"
#include "chrome/common/safe_browsing/binary_feature_extractor.h"
......@@ -58,7 +59,9 @@ void AnalyzeContainedFile(
zip::ZipReader* reader,
base::File* temp_file,
ClientDownloadRequest_ArchivedBinary* archived_binary) {
archived_binary->set_file_basename(file_path.BaseName().AsUTF8Unsafe());
std::string file_basename(file_path.BaseName().AsUTF8Unsafe());
if (base::StreamingUtf8Validator::Validate(file_basename))
archived_binary->set_file_basename(file_basename);
archived_binary->set_download_type(
download_protection_util::GetDownloadType(file_path));
archived_binary->set_length(reader->current_entry_info()->original_size());
......
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