Fix overflow calculations of blocks when device has more than 0x7FFFFFFF blocks.

This commit is contained in:
2021-07-28 17:16:38 +01:00
parent f78998d45f
commit aa2dbf3b94
6 changed files with 33 additions and 17 deletions

View File

@@ -583,7 +583,8 @@ namespace Aaru.Core.Devices.Report
{
mediaTest.SupportsReadCapacity = true;
mediaTest.Blocks = (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1;
mediaTest.Blocks = ((ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) &
0xFFFFFFFF) + 1;
mediaTest.BlockSize = (uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
}