Skip to contentSkip to conversation

display: vga: add check to limit display width

PATCH New P J P 1 participant 1 message Apr 26, 2016

lore
Share & tools
lore

P J P

author
#0 lore raw

PATCH 1/1 display: vga: add check to limit display width

From: Prasad J Pandit <[email protected]>

In vga_draw_graphic, display width could exceed the maximum range of VBE_DISPI_MAX_XRES(16000). This could lead to possible integer overflows. Add check to avoid it.

---
 hw/display/vga.c | 3 +++
 1 file changed, 3 insertions(+)
hw/display/vga.c +3 -0
index 9f68394..1a66291 100644
@@ -1478,6 +1478,9 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
             disp_width <<= 1;
         }
     }
+    if (disp_width > VBE_DISPI_MAX_XRES) {
+        disp_width = VBE_DISPI_MAX_XRES;
+    }
 
     depth = s->get_bpp(s);
 
Signature · 1 line
2.5.5