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

Commit 6404d11a authored by David Anderson's avatar David Anderson
Browse files

libsnapshot: Ignore non-data ops in snapshot_reader.

Certain ops (label, footer) do not have actual block mappings, so ignore
these.

Bug: NA
Test: apply OTA with VABC
Change-Id: I0b9ce27239553d8126c17767f35c2651df951ea0
parent 14ae4d1d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ bool CompressedSnapshotReader::SetCow(std::unique_ptr<CowReader>&& cow) {
    op_iter_ = cow_->GetOpIter();
    while (!op_iter_->Done()) {
        const CowOperation* op = &op_iter_->Get();
        if (op->type == kCowLabelOp || op->type == kCowFooterOp) {
            continue;
        }
        if (op->new_block >= ops_.size()) {
            ops_.resize(op->new_block + 1, nullptr);
        }
@@ -274,7 +277,7 @@ ssize_t CompressedSnapshotReader::ReadBlock(uint64_t chunk, IByteSink* sink, siz
            return -1;
        }
    } else {
        LOG(ERROR) << "CompressedSnapshotReader unknown op type: " << op->type;
        LOG(ERROR) << "CompressedSnapshotReader unknown op type: " << uint32_t(op->type);
        errno = EINVAL;
        return -1;
    }