Author: aandrejevic
Date: Sat Apr 18 04:21:28 2015
New Revision: 67238
URL:
http://svn.reactos.org/svn/reactos?rev=67238&view=rev
Log:
[NTVDM]
Fix the range check in VgaReadMemory and VgaWriteMemory.
Modified:
trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/hard…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c [iso-8859-1] Sat Apr 18
04:21:28 2015
@@ -1910,7 +1910,7 @@
PUCHAR BufPtr = (PUCHAR)Buffer;
DPRINT("VgaReadMemory: Address 0x%08X, Size %lu\n", Address, Size);
- Address = max(min(Address, VgaGetVideoLimitAddress() - 1),
VgaGetVideoBaseAddress());
+ Address = min(max(Address, VgaGetVideoLimitAddress() - 1),
VgaGetVideoBaseAddress());
Size = min(Size, VgaGetVideoLimitAddress() - Address + 1);
/* Ignore if video RAM access is disabled */
@@ -1939,7 +1939,7 @@
PUCHAR BufPtr = (PUCHAR)Buffer;
DPRINT("VgaWriteMemory: Address 0x%08X, Size %lu\n", Address, Size);
- Address = max(min(Address, VgaGetVideoLimitAddress() - 1),
VgaGetVideoBaseAddress());
+ Address = min(max(Address, VgaGetVideoLimitAddress() - 1),
VgaGetVideoBaseAddress());
Size = min(Size, VgaGetVideoLimitAddress() - Address + 1);
/* Ignore if video RAM access is disabled */