diff --git a/bochs/iodev/vga.cc b/bochs/iodev/vga.cc index f98b29b74..8854e64e8 100644 --- a/bochs/iodev/vga.cc +++ b/bochs/iodev/vga.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: vga.cc,v 1.30 2002-04-03 16:48:15 japj Exp $ +// $Id: vga.cc,v 1.31 2002-04-07 21:32:42 japj Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -2085,7 +2085,6 @@ bx_vga_c::vbe_mem_read(Bit32u addr) if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS) { // LFB read - // FIXME: check for max VBE video memory size offset = offset - VBE_DISPI_LFB_PHYSICAL_ADDRESS; } else @@ -2094,6 +2093,10 @@ bx_vga_c::vbe_mem_read(Bit32u addr) offset = BX_VGA_THIS s.vbe_bank*65536 + addr - 0xA0000; } + // check for out of memory read + if (offset > sizeof(BX_VGA_THIS s.vbe_memory)) + return 0; + return (BX_VGA_THIS s.vbe_memory[offset]); } @@ -2106,7 +2109,6 @@ bx_vga_c::vbe_mem_write(Bit32u addr, Bit8u value) if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS) { // LFB write - // FIXME: check for max VBE video memory size offset = offset - VBE_DISPI_LFB_PHYSICAL_ADDRESS; } else @@ -2366,4 +2368,4 @@ bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len) } } -#endif \ No newline at end of file +#endif