liblp: Fix a crash when adding an image to a partition with no extents.
Bug: N/A Test: lpmake --partition=system:readonly:0 --image=system=system.img Change-Id: I4de616cc1b9ca2838d38518ec24a382f4bc1b1be
This commit is contained in:
parent
22387708fc
commit
8fc623eb63
|
@ -312,6 +312,11 @@ static inline bool HasFillValue(uint32_t* buffer, size_t count) {
|
||||||
|
|
||||||
bool ImageBuilder::AddPartitionImage(const LpMetadataPartition& partition,
|
bool ImageBuilder::AddPartitionImage(const LpMetadataPartition& partition,
|
||||||
const std::string& file) {
|
const std::string& file) {
|
||||||
|
if (partition.num_extents == 0) {
|
||||||
|
LERROR << "Partition size is zero: " << GetPartitionName(partition);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Track which extent we're processing.
|
// Track which extent we're processing.
|
||||||
uint32_t extent_index = partition.first_extent_index;
|
uint32_t extent_index = partition.first_extent_index;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue