Author: aandrejevic
Date: Wed May 13 23:23:17 2015
New Revision: 67707
URL:
http://svn.reactos.org/svn/reactos?rev=67707&view=rev
Log:
[NTVDM]
Fill the part of the buffer that was supposed to receive memory data
above the MAX_ADDRESS with 0xFF.
Modified:
trunk/reactos/subsystems/mvdm/ntvdm/emulator.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/emulator.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/emul…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/emulator.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/emulator.c [iso-8859-1] Wed May 13 23:23:17 2015
@@ -73,8 +73,16 @@
/* If the A20 line is disabled, mask bit 20 */
if (!A20Line) Address &= ~(1 << 20);
- if (Address >= MAX_ADDRESS) return;
- Size = min(Size, MAX_ADDRESS - Address);
+ if ((Address + Size - 1) >= MAX_ADDRESS)
+ {
+ ULONG ExtraStart = (Address < MAX_ADDRESS) ? MAX_ADDRESS - Address : 0;
+
+ /* Fill the memory that was above the limit with 0xFF */
+ RtlFillMemory((PVOID)((ULONG_PTR)Buffer + ExtraStart), Size - ExtraStart, 0xFF);
+
+ if (Address < MAX_ADDRESS) Size = MAX_ADDRESS - Address;
+ else return;
+ }
/* Read while calling fast memory hooks */
MemRead(Address, Buffer, Size);