[PATCH 4/5] vgabios: Avoid possible divide by zero in bochsvga_set_displaystart.

Nov. 30, 2013
7 p.m.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net> --- vgasrc/bochsvga.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index a19eccb..6da9d5d 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -212,6 +212,8 @@ bochsvga_set_displaystart(struct vgamode_s *vmode_g, int val) if (GET_GLOBAL(dispi_found)) { int bpp = vga_bpp(vmode_g); int linelength = dispi_read(VBE_DISPI_INDEX_VIRT_WIDTH) * bpp / 8; + if (!linelength) + return 0; dispi_write(VBE_DISPI_INDEX_X_OFFSET, (val % linelength) * 8 / bpp); dispi_write(VBE_DISPI_INDEX_Y_OFFSET, val / linelength); } -- 1.8.3.1
4219
Age (days ago)
4219
Last active (days ago)
0 comments
1 participants
participants (1)
-
Kevin O'Connor