Skip to content

Commit 6404d11

Browse files
committed
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
1 parent 14ae4d1 commit 6404d11

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs_mgr/libsnapshot/snapshot_reader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ bool CompressedSnapshotReader::SetCow(std::unique_ptr<CowReader>&& cow) {
9090
op_iter_ = cow_->GetOpIter();
9191
while (!op_iter_->Done()) {
9292
const CowOperation* op = &op_iter_->Get();
93+
if (op->type == kCowLabelOp || op->type == kCowFooterOp) {
94+
continue;
95+
}
9396
if (op->new_block >= ops_.size()) {
9497
ops_.resize(op->new_block + 1, nullptr);
9598
}
@@ -274,7 +277,7 @@ ssize_t CompressedSnapshotReader::ReadBlock(uint64_t chunk, IByteSink* sink, siz
274277
return -1;
275278
}
276279
} else {
277-
LOG(ERROR) << "CompressedSnapshotReader unknown op type: " << op->type;
280+
LOG(ERROR) << "CompressedSnapshotReader unknown op type: " << uint32_t(op->type);
278281
errno = EINVAL;
279282
return -1;
280283
}

0 commit comments

Comments
 (0)