fix(disk): handle QCOW2 zero-cluster, OFLAG_COPIED, and short EOF tail in flatten #3081
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 208 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.320
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3081"
general
weight: 0.35
DefeatMan
TL;DR
Fixes QCOW2
flatten()correctness bugs inLiteBox::export: discarded zero-clusters no longer resurrect backing data, allocated L1/L2 entries setQCOW2_OFLAG_COPIED, short EOF clusters zero-pad instead of failing, and unsupportedextended_l2layers or mixedcluster_sizebacking chains are rejected before creating the output image.Design doc: None (standalone bugfix).
Documentation: [docs/contributing/architecture/README.md](docs/contributing/architecture/README.md#per-box-lifecycle-ownership)
How it works
FlattenLayer::openparses QCOW2 v3incompatible_features(hdr[72..80]) and rejects layers withQCOW2_INCOMPAT_EXTL2(1 << 4), preventing 16-byte extended L2 subcluster bitmaps from being misread at 8-byte stride.open_flatten_chainverifies everyFlattenLayer::Qcow2layer matches the top layer'scluster_bitsbefore creating the output file (FlattenLayer::Rawlayers are unaffected).0x1),read_cluster()returns zeros beforedata_offset == 0fallback. Output L1/L2 entries OR1 << 63to matchrefcount = 1. Partial EOF reads (0 < n < 64 KiB) zero-pad the tail;n == 0still errors.Verification
BOXLITE_DEPS_STUB=1 make test:unit:rust FILTER=qcow2: 26/26 passed (including Defect Proof before/after fortest_flatten_rejects_extended_l2_backingandtest_flatten_rejects_mixed_cluster_sizes, plusqemu-img check).make fmt:check:rust&make lint:rust: passed.make test(changed Rust unit + VM integration matrix): 308/308 VM integration tests passed.offset != 0) and mid-chain zero-clusters.