- Fix amd64 build
- Add an overflow check, ASSERT success when unmapping a section view

svn path=/trunk/; revision=58597
This commit is contained in:
Timo Kreuzer 2013-03-23 21:50:27 +00:00
parent 91f32c3e71
commit 2c17a42c86
2 changed files with 12 additions and 8 deletions

View file

@ -80,9 +80,9 @@ extern const FLOATOBJ gef16;
#define FLOATOBJ_16 16.
#define FLOATOBJ_1_16 (1./16.)
#define gef0 FLOATOBJ_0
#define gef1 FLOATOBJ_1
#define gef16 FLOATOBJ_16
static const FLOATOBJ gef0 = 0.;
static const FLOATOBJ gef1 = 1.;
static const FLOATOBJ gef16 = 16.;
#define FLOATOBJ_Set0(fo) *(fo) = 0;
#define FLOATOBJ_Set1(fo) *(fo) = 1;

View file

@ -26,6 +26,13 @@ EngMapSectionView(
PVOID pvBaseAddress;
NTSTATUS Status;
/* Check if the size is ok (for 64 bit) */
if (cjSize > ULONG_MAX)
{
DPRINT1("chSize out of range: 0x%Id\n", cjSize);
return NULL;
}
/* Align the offset at allocation granularity and compensate for the size */
liSectionOffset.QuadPart = cjOffset & ~(MM_ALLOCATION_GRANULARITY - 1);
cjSize += cjOffset & (MM_ALLOCATION_GRANULARITY - 1);
@ -48,7 +55,7 @@ EngMapSectionView(
}
/* Secure the section memory */
*phSecure = EngSecureMem(pvBaseAddress, cjSize);
*phSecure = EngSecureMem(pvBaseAddress, (ULONG)cjSize);
if (!*phSecure)
{
ZwUnmapViewOfSection(NtCurrentProcess(), pvBaseAddress);
@ -76,10 +83,7 @@ EngUnmapSectionView(
/* Unmap the section view */
Status = MmUnmapViewOfSection(PsGetCurrentProcess(), pvBits);
if (!NT_SUCCESS(Status))
{
DPRINT1("Could not unmap section view!\n");
}
ASSERT(NT_SUCCESS(Status));
}