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

Commit 3f0e9f2e authored by liyong's avatar liyong Committed by android-build-merger
Browse files

Merge "Fix unsigned type sub overflow issue when isntall DSU" am: 747aa9a4

am: 401cc575

Change-Id: I80528c41ac9fae0d6427f8c2422c6ee393476837
parents 58efb993 401cc575
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -95,8 +95,9 @@ std::unique_ptr<SplitFiemap> SplitFiemap::Create(const std::string& file_path, u
        // To make sure the alignment doesn't create too much inconsistency, we
        // account the *actual* size, not the requested size.
        total_bytes_written += writer->size();
        remaining_bytes -= writer->size();

        // writer->size() is block size aligned and could be bigger than remaining_bytes
        // If remaining_bytes is bigger, set remaining_bytes to 0 to avoid underflow error.
        remaining_bytes = remaining_bytes > writer->size() ? (remaining_bytes - writer->size()) : 0;
        out->AddFile(std::move(writer));
    }