mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Fix handling CRC64 of data blocks with length 0.
This commit is contained in:
27
src/open.c
27
src/open.c
@@ -387,19 +387,22 @@ void* aaruf_open(const char* filepath)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
crc64 = aaruf_crc64_data(data, blockHeader.length);
|
if(blockHeader.length > 0)
|
||||||
|
|
||||||
// Due to how C# wrote it, it is effectively reversed
|
|
||||||
if(ctx->header.imageMajorVersion <= AARUF_VERSION) crc64 = bswap_64(crc64);
|
|
||||||
|
|
||||||
if(crc64 != blockHeader.crc64)
|
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
crc64 = aaruf_crc64_data(data, blockHeader.length);
|
||||||
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
|
||||||
", continuing...\n",
|
// Due to how C# wrote it, it is effectively reversed
|
||||||
crc64,
|
if(ctx->header.imageMajorVersion <= AARUF_VERSION) crc64 = bswap_64(crc64);
|
||||||
blockHeader.crc64);
|
|
||||||
break;
|
if(crc64 != blockHeader.crc64)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"libaaruformat: Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64
|
||||||
|
", continuing...\n",
|
||||||
|
crc64,
|
||||||
|
blockHeader.crc64);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's not a media tag, but a sector tag, and fill the appropriate table then
|
// Check if it's not a media tag, but a sector tag, and fill the appropriate table then
|
||||||
|
|||||||
Reference in New Issue
Block a user