uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 3fa01a63d8b427c2e84c37753b9ed6ed254c46ff
parent 300a3d7b3ed399721cef59e9ed9efe8a1d4e0f6f
Author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
Date:   Wed, 14 Feb 2024 16:28:50 +0000

screen: fix an UB

Diffstat:
Msrc/devices/screen.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/devices/screen.c b/src/devices/screen.c @@ -62,8 +62,8 @@ screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int f int w = uxn_screen.width, h = uxn_screen.height, opaque = blending[4][color]; Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8; Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8; - for(y = y1 + ymod; y != ymax; y += fy) { - int c = *addr++ | (*(addr + 7) << 8), row = y * w; + for(y = y1 + ymod; y != ymax; y += fy, addr++) { + int c = addr[0] | (addr[8] << 8), row = y * w; if(y < h) for(x = x1 + xmod; x != xmax; x -= fx, c >>= 1) { Uint8 ch = (c & 1) | ((c >> 7) & 2);