mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛Fix dicformat crc64 calculation for metadata and last user data blocks.
This commit is contained in:
@@ -3114,6 +3114,7 @@ namespace DiscImageChef.DiscImages
|
||||
{
|
||||
lzmaProperties = lzmaBlockStream.Properties;
|
||||
lzmaBlockStream.Close();
|
||||
cmpCrc64Context.Update(lzmaProperties);
|
||||
if(blockStream.Length > decompressedStream.Length)
|
||||
currentBlockHeader.compression = CompressionType.None;
|
||||
}
|
||||
@@ -3149,6 +3150,7 @@ namespace DiscImageChef.DiscImages
|
||||
structureBytes = null;
|
||||
if(currentBlockHeader.compression == CompressionType.Lzma)
|
||||
imageStream.Write(lzmaProperties, 0, lzmaProperties.Length);
|
||||
|
||||
imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length);
|
||||
}
|
||||
|
||||
@@ -3196,7 +3198,11 @@ namespace DiscImageChef.DiscImages
|
||||
else
|
||||
{
|
||||
tagData = blockStream.ToArray();
|
||||
Crc64Context.Data(tagData, out tagCrc);
|
||||
Crc64Context crc64Ctx = new Crc64Context();
|
||||
crc64Ctx.Init();
|
||||
crc64Ctx.Update(lzmaProperties);
|
||||
crc64Ctx.Update(tagData);
|
||||
tagCrc = crc64Ctx.Final();
|
||||
tagBlock.cmpLength = (uint)tagData.Length + LZMA_PROPERTIES_LENGTH;
|
||||
tagBlock.cmpCrc64 = BitConverter.ToUInt64(tagCrc, 0);
|
||||
tagBlock.compression = CompressionType.Lzma;
|
||||
|
||||
Reference in New Issue
Block a user