mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
The region table overlap check in RegionInfo::new only rejected a new region that strictly engulfed an existing one. Identical, fully contained, and partially overlapping regions passed undetected, so a malformed VHDX with overlapping region entries was wrongly accepted. Per [MS-VHDX] all region objects MUST be non-overlapping, so such an image should be rejected. Replace the faulty predicate with a correct half-open interval overlap test, extracted into a small pure helper (ranges_overlap). Add a unit test for the predicate and an integration test that feeds a crafted region table with two overlapping entries through the real RegionInfo::new, confirming it is now rejected with RegionOverlap. Related to #8009 (broader VHDX overlap validation). Signed-off-by: Henry Hrvoje Tonkovac <htonkovac@gmail.com> Assisted-by: Claude:Opus-4.8