Fix 32 bit overflow issue in FspFsvolReadCached.

FspFsvolReadCached takes care not to read beyond the end of the file.
However, the offset check uses a 32 bit comparison, which fails for
files >= 4G.  As a result, reads on a large file will skip blocks at
offset (filesize % 4G), and those blocks will zero-filled.
This commit is contained in:
Felix A. Croes 2019-03-07 09:45:42 +01:00
parent d2de5e996c
commit b350dffe6c

View File

@ -150,7 +150,7 @@ static NTSTATUS FspFsvolReadCached(
FspFileNodeRelease(FileNode, Main);
return STATUS_END_OF_FILE;
}
if (ReadLength > (ULONG)(FileInfo.FileSize - ReadOffset.QuadPart))
if ((UINT64)ReadLength > FileInfo.FileSize - ReadOffset.QuadPart)
ReadLength = (ULONG)(FileInfo.FileSize - ReadOffset.QuadPart);
/* initialize cache if not already initialized! */