[NTOS:CC] Don't read past the end of the file in CcPerformReadAhead.

This commit is contained in:
Thomas Faber 2018-02-20 13:49:54 +01:00
parent 56e2bf2f92
commit a2f77ee3fb
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -517,6 +517,16 @@ CcPerformReadAhead(
/* Remember it's locked */
Locked = TRUE;
/* Don't read past the end of the file */
if (CurrentOffset >= SharedCacheMap->FileSize.QuadPart)
{
goto Clear;
}
if (CurrentOffset + Length > SharedCacheMap->FileSize.QuadPart)
{
Length = SharedCacheMap->FileSize.QuadPart - CurrentOffset;
}
/* Next of the algorithm will lock like CcCopyData with the slight
* difference that we don't copy data back to an user-backed buffer
* We just bring data into Cc