Commit 2c3b1945 authored by Daniel Rubery's avatar Daniel Rubery Committed by Commit Bot

Define NOVOLUME for unrar code

To prevent attempting to extract other volumes within the sandbox, this
CL puts unrar in NOVOLUME mode. I also added a quick test to ensure we
still detect the presence of files in NOVOLUME mode, so this should be
safe.

Note: The generation of multipart rar files seems a little finicky. The
following two commands worked for me.

dd if=/dev/urandom of=random.exe bs=1k count=1
rar a -v1b multipart.rar random.exe

Bug: 917679, 909778
Change-Id: I472b0e959d7538dc9136597ada631707b044e765
Reviewed-on: https://chromium-review.googlesource.com/c/1393803Reviewed-by: default avatarJay Civelli <jcivelli@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620026}
parent 477a706a
...@@ -272,5 +272,19 @@ TEST_F(SandboxedRarAnalyzerTest, ...@@ -272,5 +272,19 @@ TEST_F(SandboxedRarAnalyzerTest,
#endif #endif
} }
TEST_F(SandboxedRarAnalyzerTest, AnalyzeMultipartRarContainingExecutable) {
base::FilePath path;
// Contains one part of an exe file.
ASSERT_NO_FATAL_FAILURE(path = GetFilePath("multipart.part0001.rar"));
safe_browsing::ArchiveAnalyzerResults results;
AnalyzeFile(path, &results);
ASSERT_TRUE(results.success);
ASSERT_TRUE(results.has_executable);
EXPECT_EQ(1, results.archived_binary.size());
EXPECT_TRUE(results.archived_archive_filenames.empty());
}
} // namespace } // namespace
} // namespace safe_browsing } // namespace safe_browsing
...@@ -67,6 +67,7 @@ if (safe_browsing_mode == 1) { ...@@ -67,6 +67,7 @@ if (safe_browsing_mode == 1) {
"LARGEFILE_SOURCE", "LARGEFILE_SOURCE",
"RAR_SMP", "RAR_SMP",
"SILENT", "SILENT",
"NOVOLUME",
# The following is set to disable certain macro definitions in the unrar # The following is set to disable certain macro definitions in the unrar
# source code. # source code.
......
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