#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
#include "base/files/file.h"
#include "base/i18n/streaming_utf8_validator.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "build/build_config.h"
#include "chrome/common/safe_browsing/binary_feature_extractor.h"
#include "chrome/common/safe_browsing/download_type_util.h"
#include "components/safe_browsing/content/common/file_type_policies.h"
#include "crypto/secure_hash.h"
#include "crypto/sha2.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_MAC)
#include <mach-o/fat.h>
#include <mach-o/loader.h>
#include "base/containers/span.h"
#include "chrome/common/safe_browsing/disk_image_type_sniffer_mac.h"
#include "chrome/common/safe_browsing/mach_o_image_reader_mac.h"
#endif
namespace safe_browsing {
namespace {
void AnalyzeContainedBinary(
const scoped_refptr<BinaryFeatureExtractor>& binary_feature_extractor,
base::File* temp_file,
ClientDownloadRequest::ArchivedBinary* archived_binary) { … }
}
ArchiveAnalyzerResults::ArchiveAnalyzerResults() = default;
ArchiveAnalyzerResults::ArchiveAnalyzerResults(
const ArchiveAnalyzerResults& other) = default;
ArchiveAnalyzerResults::~ArchiveAnalyzerResults() { … }
void UpdateArchiveAnalyzerResultsWithFile(base::FilePath path,
base::File* file,
int file_length,
bool is_encrypted,
bool is_directory,
bool contents_valid,
bool is_top_level,
ArchiveAnalyzerResults* results) { … }
safe_browsing::DownloadFileType_InspectionType GetFileType(
base::FilePath path) { … }
void SetNameForContainedFile(
const base::FilePath& path,
ClientDownloadRequest::ArchivedBinary* archived_binary) { … }
void SetLengthAndDigestForContainedFile(
base::File* temp_file,
int file_length,
ClientDownloadRequest::ArchivedBinary* archived_binary) { … }
}