1
0
Fork 0

Silence buffer overrun Coverity warning

This buffer overrun could happen if implementer forgets to fill pointer
svga.set_clock, but calls VGA_SetClock with index out of bounds.
Placing assert in here should clear out false positives detected by
Coverity.
This commit is contained in:
Patryk Obara 2020-02-26 12:53:30 +01:00
parent e2196a77e2
commit cd93ea9507

View file

@ -128,11 +128,13 @@ void VGA_SetClock(Bitu which,Bitu target) {
best.n = n;
}
}
}
}
/* Program the s3 clock chip */
vga.s3.clk[which].m=best.m;
vga.s3.clk[which].r=r;
vga.s3.clk[which].n=best.n;
constexpr size_t vga_s3_clk_len = sizeof(vga.s3.clk) / sizeof(*vga.s3.clk);
assert(which < vga_s3_clk_len);
vga.s3.clk[which].m = best.m;
vga.s3.clk[which].r = r;
vga.s3.clk[which].n = best.n;
VGA_StartResize();
}