aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu2018-02-27 19:05:39 -0600
committerTianjie Xu2018-02-28 01:04:14 -0600
commitc2420845391bb8b50cb782c5fee95f0fa643e49c (patch)
tree22de4e9ea21430376e40560b2db9057a040e3335
parentbf52b7e00b63397d9c81b7f7ffa7a8b8799edd4a (diff)
downloadplatform-bootable-recovery-c2420845391bb8b50cb782c5fee95f0fa643e49c.tar.gz
platform-bootable-recovery-c2420845391bb8b50cb782c5fee95f0fa643e49c.tar.xz
platform-bootable-recovery-c2420845391bb8b50cb782c5fee95f0fa643e49c.zip
Fix the behavior of undefined commands in BlockImageVerify
In BlockImageVerify some commands are undefined, e.g. "erase", "new", "zero". And we should not error out if the corresponding function pointer of these commands is null; otherwise we will fail the verification. The old code is: if (cmd->f != nullptr && cmd->f(params) == -1) return false; In the last_command_file change the logic was wrongly modified to if (cmd->f == nullptr) return false; ... if (cmd->f(params) == -1) return false; Test: sideload an incremental OTA twice on bullhead Change-Id: I2561c365badb850da0e416629ccd61f0df7da5d7
-rw-r--r--updater/blockimg.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index feb2aeb2..4f085b20 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -1727,9 +1727,11 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
1727 1727
1728 const Command* cmd = cmd_map[params.cmdname]; 1728 const Command* cmd = cmd_map[params.cmdname];
1729 1729
1730 // Skip the command if we explicitly set the corresponding function pointer to nullptr, e.g.
1731 // "erase" during block_image_verify.
1730 if (cmd->f == nullptr) { 1732 if (cmd->f == nullptr) {
1731 LOG(ERROR) << "failed to find the function for command [" << line << "]"; 1733 LOG(DEBUG) << "skip executing command [" << line << "]";
1732 goto pbiudone; 1734 continue;
1733 } 1735 }
1734 1736
1735 // Skip all commands before the saved last command index when resuming an update. 1737 // Skip all commands before the saved last command index when resuming an update.