mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
render-cg: fix potential VRAM overflow in gint_dhline()
A missing coordinate check in gint_dhline() would allow lines entirely out of bounds of the screen to write pixels outside of their expected range, often wrapping up to the next line, but possibly overflowing from VRAM.
This commit is contained in:
parent
caa4f675c9
commit
610362f8c9
1 changed files with 1 additions and 0 deletions
|
@ -7,6 +7,7 @@ void gint_dhline(int x1, int x2, int y, uint16_t color)
|
|||
/* Order and bounds */
|
||||
if((uint)y >= 224) return;
|
||||
if(x1 > x2) swap(x1, x2);
|
||||
if(x1 >= 396 || x2 < 0) return;
|
||||
if(x1 < 0) x1 = 0;
|
||||
if(x2 >= 396) x2 = 395;
|
||||
|
||||
|
|
Loading…
Reference in a new issue