- attempt to fix SF bug #2867904: improved checks if VGA memory address is out

of bounds
This commit is contained in:
Volker Ruppert 2009-09-27 18:37:02 +00:00
parent 2f65d8dfe8
commit 31d479f119

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.cc,v 1.167 2009-07-04 07:40:46 vruppert Exp $
// $Id: vga.cc,v 1.168 2009-09-27 18:37:02 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -2390,7 +2390,7 @@ void bx_vga_c::mem_write(bx_phy_address addr, Bit8u value)
switch (BX_VGA_THIS s.graphics_ctrl.memory_mapping) {
case 1: // 0xA0000 .. 0xAFFFF
if (addr > 0xAFFFF) return;
if ((addr < 0xA0000) || (addr > 0xAFFFF)) return;
offset = addr - 0xA0000;
break;
case 2: // 0xB0000 .. 0xB7FFF
@ -2398,10 +2398,11 @@ void bx_vga_c::mem_write(bx_phy_address addr, Bit8u value)
offset = addr - 0xB0000;
break;
case 3: // 0xB8000 .. 0xBFFFF
if (addr < 0xB8000) return;
if ((addr < 0xB8000) || (addr > 0xBFFFF)) return;
offset = addr - 0xB8000;
break;
default: // 0xA0000 .. 0xBFFFF
if ((addr < 0xA0000) || (addr > 0xBFFFF)) return;
offset = addr - 0xA0000;
}