Index: chrome/installer/setup/archive_patch_helper_unittest.cc |
diff --git a/chrome/installer/setup/archive_patch_helper_unittest.cc b/chrome/installer/setup/archive_patch_helper_unittest.cc |
index f42ed5baffa6a9d214ec9f50732ec33f76d4496b..8e6c996be48981b4a5f95443582a2d9d85a09fba 100644 |
--- a/chrome/installer/setup/archive_patch_helper_unittest.cc |
+++ b/chrome/installer/setup/archive_patch_helper_unittest.cc |
@@ -59,3 +59,29 @@ TEST_F(ArchivePatchHelperTest, Patching) { |
base::FilePath base = data_dir_.AppendASCII("archive2.7z"); |
EXPECT_TRUE(base::ContentsEqual(dest, base)); |
} |
+ |
+TEST_F(ArchivePatchHelperTest, InvalidDiff_MisalignedCblen) { |
+ base::FilePath src = data_dir_.AppendASCII("bin.old"); |
+ base::FilePath patch = data_dir_.AppendASCII("misaligned_cblen.diff"); |
+ base::FilePath dest = test_dir_.path().AppendASCII("bin.new"); |
+ installer::ArchivePatchHelper archive_helper(test_dir_.path(), |
+ base::FilePath(), |
+ src, |
+ dest); |
+ archive_helper.set_last_uncompressed_file(patch); |
+ // Should fail, but not crash. |
+ EXPECT_FALSE(archive_helper.BinaryPatch()); |
+} |
+ |
+TEST_F(ArchivePatchHelperTest, InvalidDiff_NegativeSeek) { |
+ base::FilePath src = data_dir_.AppendASCII("bin.old"); |
+ base::FilePath patch = data_dir_.AppendASCII("negative_seek.diff"); |
+ base::FilePath dest = test_dir_.path().AppendASCII("bin.new"); |
+ installer::ArchivePatchHelper archive_helper(test_dir_.path(), |
+ base::FilePath(), |
+ src, |
+ dest); |
+ archive_helper.set_last_uncompressed_file(patch); |
+ // Should fail, but not crash. |
+ EXPECT_FALSE(archive_helper.BinaryPatch()); |
+} |