Fix the uninitialized zeros buffer when zeroing blocks
The zeros buffer is uninitialized if "attempt_ioctl" is false at the
first iteration, leading to an infinite loop when verifying payload on
host.
Test: Update verification on host no longer stuck
Change-Id: I5552ff872e3d0e59098f32822cf5d5f0d724e7f1
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 0fb0a77..7c94c71 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -1011,9 +1011,9 @@
if (target_fd_->BlkIoctl(request, start, length, &result) && result == 0)
continue;
attempt_ioctl = false;
- zeros.resize(16 * block_size_);
}
// In case of failure, we fall back to writing 0 to the selected region.
+ zeros.resize(16 * block_size_);
for (uint64_t offset = 0; offset < length; offset += zeros.size()) {
uint64_t chunk_length = min(length - offset,
static_cast<uint64_t>(zeros.size()));