From: Michael Gilbert <mgilbert@debian.org>
Date: Wed, 21 Nov 2018 02:37:35 +0000
Subject: Disable support for RAR files inspection

License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
 .../download_protection/file_analyzer.cc      |  2 +-
 chrome/common/safe_browsing/BUILD.gn          | 33 -------------------
 .../file_util/safe_archive_analyzer.cc        |  4 +--
 3 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/chrome/browser/safe_browsing/download_protection/file_analyzer.cc b/chrome/browser/safe_browsing/download_protection/file_analyzer.cc
--- a/chrome/browser/safe_browsing/download_protection/file_analyzer.cc
+++ b/chrome/browser/safe_browsing/download_protection/file_analyzer.cc
@@ -95,7 +95,7 @@ void FileAnalyzer::Start(const base::FilePath& target_path,
   if (inspection_type == DownloadFileType::ZIP) {
     StartExtractZipFeatures();
   } else if (inspection_type == DownloadFileType::RAR) {
-    StartExtractRarFeatures();
+    LOG(WARNING) << "Safebrowser inspection of rar files is disabled in this build";
 #if BUILDFLAG(IS_MAC)
   } else if (inspection_type == DownloadFileType::DMG) {
     StartExtractDmgFeatures();
diff --git a/chrome/common/safe_browsing/BUILD.gn b/chrome/common/safe_browsing/BUILD.gn
--- a/chrome/common/safe_browsing/BUILD.gn
+++ b/chrome/common/safe_browsing/BUILD.gn
@@ -56,38 +56,6 @@ if (safe_browsing_mode == 1) {
     public_deps = [ "//components/safe_browsing/core/common/proto:csd_proto" ]
   }
 
-  source_set("rar_analyzer") {
-    sources = [
-      "rar_analyzer.cc",
-      "rar_analyzer.h",
-    ]
-
-    deps = [
-      ":archive_analyzer_results",
-      ":download_type_util",
-      "//base",
-      "//base:i18n",
-      "//components/safe_browsing/core/common",
-      "//third_party/unrar:unrar",
-    ]
-
-    defines = [
-      "_FILE_OFFSET_BITS=64",
-      "LARGEFILE_SOURCE",
-      "RAR_SMP",
-      "SILENT",
-
-      # The following is set to disable certain macro definitions in the unrar
-      # source code.
-      "CHROMIUM_UNRAR",
-
-      # Disables exceptions in unrar, replaces them with process termination.
-      "UNRAR_NO_EXCEPTIONS",
-    ]
-
-    public_deps = [ "//components/safe_browsing/core/common/proto:csd_proto" ]
-  }
-
   if (is_linux || is_win) {
     source_set("document_analyzer") {
       sources = [
@@ -184,7 +152,6 @@ source_set("safe_browsing") {
       ":archive_analyzer_results",
       ":binary_feature_extractor",
       ":download_type_util",
-      ":rar_analyzer",
       "//components/safe_browsing/core/common",
       "//third_party/lzma_sdk/google:seven_zip_reader",
     ]
diff --git a/chrome/services/file_util/safe_archive_analyzer.cc b/chrome/services/file_util/safe_archive_analyzer.cc
--- a/chrome/services/file_util/safe_archive_analyzer.cc
+++ b/chrome/services/file_util/safe_archive_analyzer.cc
@@ -6,7 +6,6 @@
 
 #include "build/build_config.h"
 #include "chrome/common/safe_browsing/archive_analyzer_results.h"
-#include "chrome/common/safe_browsing/rar_analyzer.h"
 #include "chrome/common/safe_browsing/seven_zip_analyzer.h"
 #include "chrome/common/safe_browsing/zip_analyzer.h"
 
@@ -47,9 +46,8 @@ void SafeArchiveAnalyzer::AnalyzeRarFile(base::File rar_file,
                                          AnalyzeRarFileCallback callback) {
   DCHECK(rar_file.IsValid());
 
+  LOG(FATAL) << "AnalyzeRarFile is disabled in this build";
   safe_browsing::ArchiveAnalyzerResults results;
-  safe_browsing::rar_analyzer::AnalyzeRarFile(
-      std::move(rar_file), std::move(temporary_file), &results);
   std::move(callback).Run(results);
 }
 
--
2.25.1
