From 39258ecdeb042cc30120f8043e602e6b7c046c71 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 8 Jan 2024 13:27:24 +0100 Subject: [PATCH] And added even more sanity checks. --- src/video/vid_cga.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index f61b85e10..2ba4323f3 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -445,14 +445,17 @@ cga_interpolate(cga_t *cga, int x, int y, int w, int h) color_t interim_1, interim_2; color_t final; + if (i < 0) + continue; + black.color = 0x00000000; - if (prev >= 0) + if ((prev >= 0) && (prev < (y + h))) prev_color.color = buffer32->line[prev][j]; else prev_color.color = 0x00000000; - if (next < (y + h)) + if ((next >= 0) && (next < (y + h))) next_color.color = buffer32->line[next][j]; else next_color.color = 0x00000000;