mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2026-07-09 02:16:24 +00:00
V1 images stored cmpCrc64 over the full LZMA payload including the 5-byte properties prefix, but verify.c unconditionally skipped the prefix before computing the CRC. This caused aaruf_verify_image() to report AARUF_ERROR_INVALID_BLOCK_CRC on every valid v1 image. The fix makes the LZMA properties skip conditional on v2+ images: - V1: CRC computed over full cmpLength (properties included), then byte-swapped - V2+: CRC computed over cmpLength minus 5 (properties excluded), no byte-swap Applies to DataBlock, DeDuplicationTable (v1), and DeDuplicationTable2. Verified against fixtures created by Aaru 5.3 (v1) and aaruformattool (v2). Tests added (14 total, VerifyImageFixture suite): - Happy path: floptical/mf2hd/cdmode1 for both v1 and v2 (6 tests) - Invalid context: NULL and garbage (2 tests) - Corruption detection: data block v1/v2, TracksBlock (3 tests) - Index corruption: invalid offset, bad signature (2 tests) - Programmatic round-trip: create + write + close + verify (1 test)