0014-chrome-common-remove-unrar-code.patch 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. From 796fe4577f25873b97485b430b1fd17d72d4fcea Mon Sep 17 00:00:00 2001
  2. From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
  3. Date: Thu, 13 Jan 2022 08:57:34 +0000
  4. Subject: [PATCH 14/22] chrome: common: remove unrar code
  5. Upstream-status: Inappropriate
  6. unrar code is non-free. This might not be suitable for
  7. distributing as third_party. Hence we disabled it from
  8. our build.
  9. Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
  10. ---
  11. chrome/common/safe_browsing/BUILD.gn | 34 -------------------
  12. chrome/common/safe_browsing/DEPS | 1 -
  13. chrome/services/file_util/BUILD.gn | 1 -
  14. .../file_util/safe_archive_analyzer.cc | 4 +++
  15. 4 files changed, 4 insertions(+), 36 deletions(-)
  16. diff --git a/chrome/common/safe_browsing/BUILD.gn b/chrome/common/safe_browsing/BUILD.gn
  17. index dbd1ae28552ce..b67ca3bf09031 100644
  18. --- a/chrome/common/safe_browsing/BUILD.gn
  19. +++ b/chrome/common/safe_browsing/BUILD.gn
  20. @@ -58,39 +58,6 @@ if (safe_browsing_mode == 1) {
  21. public_deps = [ "//components/safe_browsing/core/common/proto:csd_proto" ]
  22. }
  23. - source_set("rar_analyzer") {
  24. - sources = [
  25. - "rar_analyzer.cc",
  26. - "rar_analyzer.h",
  27. - ]
  28. -
  29. - deps = [
  30. - ":archive_analyzer_results",
  31. - ":download_type_util",
  32. - "//base",
  33. - "//base:i18n",
  34. - "//components/safe_browsing/content/common:file_type_policies",
  35. - "//components/safe_browsing/core/common",
  36. - "//third_party/unrar:unrar",
  37. - ]
  38. -
  39. - defines = [
  40. - "_FILE_OFFSET_BITS=64",
  41. - "LARGEFILE_SOURCE",
  42. - "RAR_SMP",
  43. - "SILENT",
  44. -
  45. - # The following is set to disable certain macro definitions in the unrar
  46. - # source code.
  47. - "CHROMIUM_UNRAR",
  48. -
  49. - # Disables exceptions in unrar, replaces them with process termination.
  50. - "UNRAR_NO_EXCEPTIONS",
  51. - ]
  52. -
  53. - public_deps = [ "//components/safe_browsing/core/common/proto:csd_proto" ]
  54. - }
  55. -
  56. if (is_linux || is_win) {
  57. source_set("document_analyzer") {
  58. sources = [
  59. @@ -189,7 +156,6 @@ source_set("safe_browsing") {
  60. ":archive_analyzer_results",
  61. ":binary_feature_extractor",
  62. ":download_type_util",
  63. - ":rar_analyzer",
  64. "//components/safe_browsing/core/common",
  65. ]
  66. diff --git a/chrome/common/safe_browsing/DEPS b/chrome/common/safe_browsing/DEPS
  67. index b8f7708dcef7b..28723c2e64728 100644
  68. --- a/chrome/common/safe_browsing/DEPS
  69. +++ b/chrome/common/safe_browsing/DEPS
  70. @@ -3,6 +3,5 @@ include_rules = [
  71. "+components/safe_browsing/core/common",
  72. "+third_party/maldoca",
  73. "+third_party/protobuf",
  74. - "+third_party/unrar",
  75. "+third_party/zlib",
  76. ]
  77. diff --git a/chrome/services/file_util/BUILD.gn b/chrome/services/file_util/BUILD.gn
  78. index 8a50b0932e0bc..85ec598cf712a 100644
  79. --- a/chrome/services/file_util/BUILD.gn
  80. +++ b/chrome/services/file_util/BUILD.gn
  81. @@ -60,7 +60,6 @@ source_set("file_util") {
  82. deps += [
  83. "//chrome/common/safe_browsing",
  84. "//chrome/common/safe_browsing:archive_analyzer_results",
  85. - "//chrome/common/safe_browsing:rar_analyzer",
  86. ]
  87. if (is_linux || is_win) {
  88. diff --git a/chrome/services/file_util/safe_archive_analyzer.cc b/chrome/services/file_util/safe_archive_analyzer.cc
  89. index 3b647cd93546f..d29f46c473bee 100644
  90. --- a/chrome/services/file_util/safe_archive_analyzer.cc
  91. +++ b/chrome/services/file_util/safe_archive_analyzer.cc
  92. @@ -44,10 +44,14 @@ void SafeArchiveAnalyzer::AnalyzeDmgFile(base::File dmg_file,
  93. void SafeArchiveAnalyzer::AnalyzeRarFile(base::File rar_file,
  94. base::File temporary_file,
  95. AnalyzeRarFileCallback callback) {
  96. +#if 0
  97. DCHECK(rar_file.IsValid());
  98. safe_browsing::ArchiveAnalyzerResults results;
  99. safe_browsing::rar_analyzer::AnalyzeRarFile(
  100. std::move(rar_file), std::move(temporary_file), &results);
  101. std::move(callback).Run(results);
  102. +#else
  103. + NOTREACHED();
  104. +#endif
  105. }
  106. --
  107. 2.25.1