Skip to content

Commit

Permalink
[unrar] Fix fuzzer build breakage.
Browse files Browse the repository at this point in the history
Bug: 961748
Change-Id: I1d7067e8c2142abeb9497b1ac2c096fad2bcd157
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1605166
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Commit-Queue: Varun Khaneja <vakh@chromium.org>
Reviewed-by: Varun Khaneja <vakh@chromium.org>
Auto-Submit: Jonathan Metzman <metzman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658786}
  • Loading branch information
jonathanmetzman authored and Commit Bot committed May 10, 2019
1 parent d0b14fb commit 2cd234b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
45 changes: 25 additions & 20 deletions third_party/unrar/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,10 @@ if (safe_browsing_mode == 1 || use_fuzzing_engine) {
"//build/config/compiler:no_chromium_code",

# This must be after no_chromium_code for warning flags to be ordered correctly
":unrar_warnings",
":unrar_config",
]

defines = [
"_FILE_OFFSET_BITS=64",
"LARGEFILE_SOURCE",
"RAR_SMP",
"SILENT",
"NOVOLUME",

# The following is set to disable certain macro definitions in the unrar
# source code.
"CHROMIUM_UNRAR",
]

if (!use_libfuzzer) {
# Disables exceptions in unrar, replaces them with process termination.
defines += [ "UNRAR_NO_EXCEPTIONS" ]
} else {
if (use_libfuzzer) {
configs -= [ "//build/config/compiler:no_exceptions" ]
}

Expand All @@ -102,13 +87,19 @@ if (safe_browsing_mode == 1 || use_fuzzing_engine) {
":unrar",
]
include_dirs = [ "//third_party/unrar/src" ]
defines = [ "CHROMIUM_UNRAR" ]
configs_to_remove = [ "//build/config/compiler:no_exceptions" ]
additional_configs = [
"//build/config/compiler:no_chromium_code",
":unrar_config",
]
configs_to_remove = [
"//build/config/compiler:no_exceptions",
"//build/config/compiler:chromium_code",
]
}
}
}

config("unrar_warnings") {
config("unrar_config") {
cflags = [
# unrar frequently drops parentheses around logical ops
"-Wno-logical-op-parentheses",
Expand All @@ -125,4 +116,18 @@ config("unrar_warnings") {
# unrar has missing braces for initialization in rarvm.cpp
"-Wno-missing-braces",
]

defines = [
"_FILE_OFFSET_BITS=64",
"LARGEFILE_SOURCE",
"RAR_SMP",
"SILENT",
"NOVOLUME",
"CHROMIUM_UNRAR",
]

if (!use_libfuzzer) {
# Disables exceptions in unrar, replaces them with process termination.
defines += [ "UNRAR_NO_EXCEPTIONS" ]
}
}
3 changes: 0 additions & 3 deletions third_party/unrar/unrar_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

#include "rar.hpp"

using third_party_unrar::CmdExtract;
using third_party_unrar::CommandData;

static int removeFile(const char* fpath,
const struct stat* sb,
int typeflag,
Expand Down

0 comments on commit 2cd234b

Please sign in to comment.