mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
Standard L2 data offsets and L1-referenced L2 table offsets must be aligned and covered by the current refcount table. The write path checked both constraints at one call site, while read, cache population, and deallocation paths only checked alignment or relied on later refcount lookup errors. Centralize the validation in QcowState and use it before reading L2 tables, mapping standard L2 entries for reads and writes, and deallocating existing clusters. Invalid offsets set the corrupt bit and fail with EIO before data I/O or refcount updates. Add QcowSync regression tests that corrupt a standard L2 entry past the refcount-addressable range and verify that reads and writes fail with EIO and mark the header corrupt. Assisted-by: Codex:GPT-5 Signed-off-by: Ian Klemm <hi@ianklemm.de>