Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69863bd9 authored by David Anderson's avatar David Anderson Committed by Gerrit Code Review
Browse files

Merge "liblp: Fix a crash when adding an image to a partition with no extents."

parents 77f4cb4d 8fc623eb
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -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;