mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix incorrect casting and null references on DiscImageChef format.
This commit is contained in:
@@ -761,7 +761,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
imageStream.Read(structureBytes, 0, structureBytes.Length);
|
imageStream.Read(structureBytes, 0, structureBytes.Length);
|
||||||
structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(cicmBlock));
|
structurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(cicmBlock));
|
||||||
Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(cicmBlock));
|
Marshal.Copy(structureBytes, 0, structurePointer, Marshal.SizeOf(cicmBlock));
|
||||||
cicmBlock = (CicmMetadataBlock)Marshal.PtrToStructure(structurePointer, typeof(GeometryBlock));
|
cicmBlock = (CicmMetadataBlock)Marshal.PtrToStructure(structurePointer, typeof(CicmMetadataBlock));
|
||||||
Marshal.FreeHGlobal(structurePointer);
|
Marshal.FreeHGlobal(structurePointer);
|
||||||
if(cicmBlock.identifier != BlockType.CicmBlock) break;
|
if(cicmBlock.identifier != BlockType.CicmBlock) break;
|
||||||
|
|
||||||
@@ -895,8 +895,11 @@ namespace DiscImageChef.DiscImages
|
|||||||
for(uint j = 0; j < dumpEntry.extents; j++)
|
for(uint j = 0; j < dumpEntry.extents; j++)
|
||||||
{
|
{
|
||||||
imageStream.Read(tmp, 0, tmp.Length);
|
imageStream.Read(tmp, 0, tmp.Length);
|
||||||
dump.Extents[0].Start = BitConverter.ToUInt64(tmp, 0);
|
dump.Extents[j] = new ExtentType
|
||||||
dump.Extents[0].End = BitConverter.ToUInt64(tmp, 8);
|
{
|
||||||
|
Start = BitConverter.ToUInt64(tmp, 0),
|
||||||
|
End = BitConverter.ToUInt64(tmp, 8)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
dump.Extents = dump.Extents.OrderBy(t => t.Start).ToArray();
|
dump.Extents = dump.Extents.OrderBy(t => t.Start).ToArray();
|
||||||
|
|||||||
@@ -810,7 +810,7 @@ typedef struct
|
|||||||
uint length;
|
uint length;
|
||||||
uint64 crc64 <format=hex>;
|
uint64 crc64 <format=hex>;
|
||||||
DumpHardwareEntry dumpHardware[entries];
|
DumpHardwareEntry dumpHardware[entries];
|
||||||
} DumpHardwareHeader;
|
} DumpHardwareHeader <optimize=false>;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user