diff --git a/hw/display/vga.c b/hw/display/vga.c index a64a0942da5f8b6033a545e85cb5a26d68e83cba..d150a3a3eb5cf602bb93713b06f5d076894543a9 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1280,6 +1280,9 @@ static void vga_draw_text(VGACommonState *s, int full_update) cx_min = width; cx_max = -1; for(cx = 0; cx < width; cx++) { + if (src + sizeof(uint16_t) > s->vram_ptr + s->vram_size) { + break; + } ch_attr = *(uint16_t *)src; if (full_update || ch_attr != *ch_attr_ptr || src == cursor_ptr) { if (cx < cx_min)