From b0eb08937ad2687dc152e155e3bd87fa127632b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Sat, 4 Jan 2025 23:41:10 -0500 Subject: [PATCH] Handle case when font[0] == NULL Shouldn't happen, but if it does, return an error, don't dereference Found by scan-build. --- src/conio/bitmap_con.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 480a2e8dd1..7e6589fca4 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -582,6 +582,8 @@ static int bitmap_draw_one_char(struct vmem_cell *vc, unsigned int xpos, unsigne if (this_font == NULL) { this_font = font[0]; } + if (this_font == NULL) + return(-1); fdw = vstat.charwidth - (vstat.flags & VIDMODES_FLAG_EXPAND) ? 1 : 0; fontoffset=(sch) * (vstat.charheight * ((fdw + 7) / 8)); -- GitLab