summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-10 08:04:17 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-07-10 08:04:17 +0200
commit876fcbe84a480f15f45b1e63eb847eaf6c2d8995 (patch)
tree4136df9997adcb0318b63f2582f10ed2c71541fa
parentMerge "updater: Remove the support for sha1_check()." am: fbc0f6062c am: e2136c46cb (diff)
parentMerge "applypatch: Fix a potential nullptr dereferencing." am: b9b50cd58c (diff)
downloadandroid_bootable_recovery-876fcbe84a480f15f45b1e63eb847eaf6c2d8995.tar
android_bootable_recovery-876fcbe84a480f15f45b1e63eb847eaf6c2d8995.tar.gz
android_bootable_recovery-876fcbe84a480f15f45b1e63eb847eaf6c2d8995.tar.bz2
android_bootable_recovery-876fcbe84a480f15f45b1e63eb847eaf6c2d8995.tar.lz
android_bootable_recovery-876fcbe84a480f15f45b1e63eb847eaf6c2d8995.tar.xz
android_bootable_recovery-876fcbe84a480f15f45b1e63eb847eaf6c2d8995.tar.zst
android_bootable_recovery-876fcbe84a480f15f45b1e63eb847eaf6c2d8995.zip
-rw-r--r--applypatch/applypatch.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index e6fd5f6ae..69928bcfb 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -622,10 +622,13 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr
SHA1(reinterpret_cast<const uint8_t*>(patch->data.data()), patch->data.size(), patch_digest);
LOG(ERROR) << "patch size " << patch->data.size() << " SHA-1 " << short_sha1(patch_digest);
- uint8_t bonus_digest[SHA_DIGEST_LENGTH];
- SHA1(reinterpret_cast<const uint8_t*>(bonus_data->data.data()), bonus_data->data.size(),
- bonus_digest);
- LOG(ERROR) << "bonus size " << bonus_data->data.size() << " SHA-1 " << short_sha1(bonus_digest);
+ if (bonus_data != nullptr) {
+ uint8_t bonus_digest[SHA_DIGEST_LENGTH];
+ SHA1(reinterpret_cast<const uint8_t*>(bonus_data->data.data()), bonus_data->data.size(),
+ bonus_digest);
+ LOG(ERROR) << "bonus size " << bonus_data->data.size() << " SHA-1 "
+ << short_sha1(bonus_digest);
+ }
// TODO(b/67849209) Remove after debugging the unit test flakiness.
if (android::base::GetMinimumLogSeverity() <= android::base::LogSeverity::DEBUG) {