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

Commit 27a34d71 authored by Yifan Hong's avatar Yifan Hong
Browse files

liblp: SparseBuilder: num_blocks aren't check correctly

Test: builds

Change-Id: Ic0fe481cd168217d764b7c69dfe9da124a277f82
parent 7d3f0066
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ SparseBuilder::SparseBuilder(const LpMetadata& metadata, uint32_t block_size,
        return;
    }

    uint64_t num_blocks = total_size % block_size;
    uint64_t num_blocks = total_size / block_size;
    if (num_blocks >= UINT_MAX) {
        // libsparse counts blocks in unsigned 32-bit integers, so we check to
        // make sure we're not going to overflow.