[NTOS:MM] Fail on SizeOfRawData overflow. CORE-17284

Fixes the corresponding tests in ntdll_apitest:NtMapViewOfSection.
Also add a TODO for the remaining test failures.
This commit is contained in:
Thomas Faber 2020-09-27 17:48:33 +02:00
parent b957af4b6b
commit e57a59a60a
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -723,12 +723,16 @@ l_ReadHeaderFromFile:
// if(!IsAligned(pishSectionHeaders[i].PointerToRawData, nFileAlignment))
// DIE(("PointerToRawData[%u] is not aligned\n", i));
if(!Intsafe_CanAddULong32(pishSectionHeaders[i].PointerToRawData, pishSectionHeaders[i].SizeOfRawData))
DIE(("SizeOfRawData[%u] too large\n", i));
/* conversion */
pssSegments[i].Image.FileOffset = pishSectionHeaders[i].PointerToRawData;
pssSegments[i].RawLength.QuadPart = pishSectionHeaders[i].SizeOfRawData;
}
else
{
/* FIXME: Should reset PointerToRawData to 0 in the image mapping */
ASSERT(pssSegments[i].Image.FileOffset == 0);
ASSERT(pssSegments[i].RawLength.QuadPart == 0);
}