From 56843eec457cc06ccf7d39db56ebcd3dba25df8b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 4 Sep 2018 17:57:36 -0700 Subject: [PATCH] fastbootd: Perform CRC check when flashing sparse images. Bug: 78793464 Test: fuzzy_fastboot Conformance.SparseCRCCheck passes Change-Id: I717fbec42599a43bafafa1f73837e115a9f9109a --- fastboot/device/flashing.cpp | 2 +- fastboot/fuzzy_fastboot/main.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fastboot/device/flashing.cpp b/fastboot/device/flashing.cpp index e3efbcba2..a383c54b2 100644 --- a/fastboot/device/flashing.cpp +++ b/fastboot/device/flashing.cpp @@ -72,7 +72,7 @@ int WriteCallback(void* priv, const void* data, size_t len) { } int FlashSparseData(int fd, std::vector& downloaded_data) { - struct sparse_file* file = sparse_file_import_buf(downloaded_data.data(), true, false); + struct sparse_file* file = sparse_file_import_buf(downloaded_data.data(), true, true); if (!file) { return -ENOENT; } diff --git a/fastboot/fuzzy_fastboot/main.cpp b/fastboot/fuzzy_fastboot/main.cpp index dd64082f7..8fb5a6a11 100644 --- a/fastboot/fuzzy_fastboot/main.cpp +++ b/fastboot/fuzzy_fastboot/main.cpp @@ -570,7 +570,6 @@ TEST_F(Conformance, SparseCRCCheck) { buf.back() = buf.back() ^ 0x01; ASSERT_EQ(DownloadCommand(buf.size()), SUCCESS) << "Device rejected download command"; ASSERT_EQ(SendBuffer(buf), SUCCESS) << "Downloading payload failed"; - printf("%02x\n", (unsigned char)buf.back()); // It can either reject this download or reject it during flash if (HandleResponse() != DEVICE_FAIL) { EXPECT_EQ(fb->Flash("userdata"), DEVICE_FAIL)