The image fuzzer from Maria exposed a lot of assertions which might fail in qemu when fed with a broken qcow2 image. Some of them are related to qemu trusting the offsets given in the L1, L2 and refcount tables to always be properly aligned on cluster boundaries (e.g. https://bugs.launchpad.net/qemu/+bug/1354529).
This series fixes this by verifying (hopefully) all data read from L1, L2 and refcount tables accordingly; if the offsets are not aligned on cluster boundaries, an error message is emitted and the image is marked corrupt unless it has been opened read-only. Max Reitz (4): qcow2: Add qcow2_signal_corruption() qcow2: Use qcow2_signal_corruption() for overlaps iotests: Fix output of 060 qcow2: Check L1/L2/reftable entries for alignment block/qcow2-cluster.c | 27 ++++++++++++++++++++- block/qcow2-refcount.c | 59 +++++++++++++++++++++++++++++----------------- block/qcow2.c | 28 ++++++++++++++++++++++ block/qcow2.h | 4 ++++ tests/qemu-iotests/060.out | 10 ++++---- 5 files changed, 100 insertions(+), 28 deletions(-) -- 2.0.4