update_engine: fix 32bit system type error
size_t is 32 bits on 32 bit systems. This leads to a type conversion
error when trying to calculate read_size. We should change the min
calculation to use 64 bit uint, and then do truncation afterwards.
Bug: 359465125
Test: ota successful on pixel watch
Change-Id: Iaac26fc2fa39d1ee80d2aa9be11c2c1a8a70722b
diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
index 5345085..93e61bf 100644
--- a/payload_consumer/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -273,7 +273,7 @@
return;
}
const auto read_size =
- std::min<size_t>(buffer_size, end_offset - start_offset);
+ std::min<uint64_t>(buffer_size, end_offset - start_offset);
const auto bytes_read = fd->Read(buffer, read_size);
if (bytes_read < 0 || static_cast<size_t>(bytes_read) != read_size) {
PLOG(ERROR) << "Failed to read offset " << start_offset << " expected "