render-fx: fix VRAM overflows in gint_dhline() and gint_dvline()

Similar to 610362f.
This commit is contained in:
Lephe 2020-06-15 13:44:51 +02:00
parent d8886c7dbf
commit fbfcdd7664
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
2 changed files with 3 additions and 1 deletions

View file

@ -7,6 +7,7 @@ void gint_dhline(int x1, int x2, int y, color_t color)
{
if((uint)y >= 64) return;
if(x1 > x2) swap(x1, x2);
if(x1 >= 128 || x2 < 0) return;
/* Get the masks for the [x1, x2] range */
uint32_t m[4];
@ -42,6 +43,7 @@ void gint_dvline(int y1, int y2, int x, color_t color)
{
if((uint)x >= 128) return;
if(y1 > y2) swap(y1, y2);
if(y1 >= 64 || y2 < 0) return;
uint32_t *base = gint_vram + (y1 << 2) + (x >> 5);
uint32_t *lword = base + ((y2 - y1 + 1) << 2);

View file

@ -4,7 +4,7 @@
void masks(int x1, int x2, uint32_t *masks)
{
if(x1 < 0) x1 = 0;
if(x2 < 0) x2 = 0;
if(x2 >= 128) x2 = 127;
/* Indexes of the first and last non-empty longs */
size_t l1 = x1 >> 5;