Merge "liblp: Fix a crash when adding an image to a partition with no extents." am: 69863bd977 am: 6b4cc0a8ad am: 40fc9593b7

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2428712

Change-Id: If858e96872264f3c047b561478375f4a13501a38
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
David Anderson 2023-02-14 01:50:28 +00:00 committed by Automerger Merge Worker
commit b7d8b7e150

View file

@ -312,6 +312,11 @@ static inline bool HasFillValue(uint32_t* buffer, size_t count) {
bool ImageBuilder::AddPartitionImage(const LpMetadataPartition& partition,
const std::string& file) {
if (partition.num_extents == 0) {
LERROR << "Partition size is zero: " << GetPartitionName(partition);
return false;
}
// Track which extent we're processing.
uint32_t extent_index = partition.first_extent_index;