From 36846753715b846ee60ab2c0b7cd5175ecaacb5b Mon Sep 17 00:00:00 2001 From: NepDisk Date: Tue, 13 Jan 2026 16:05:05 -0500 Subject: [PATCH] Prevent asan from aborting over tabs and stringwidth funcs --- src/v_video.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/v_video.c b/src/v_video.c index 06940540a..faad604b6 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -3619,6 +3619,9 @@ INT32 V_SubStringWidth(const char *string, INT32 length, INT32 option) if ((UINT8)c & 0x80) //color parsing! -Inuyasha 2.16.09 continue; + if (c < HU_FONTSTART) + continue; // this is not a proper character. + c = toupper(c) - HU_FONTSTART; if (c < 0 || c >= HU_FONTSIZE || !fontv[HU_FONT].font[c]) lw += spacewidth; @@ -3672,6 +3675,9 @@ INT32 V_SmallSubStringWidth(const char *string, INT32 length, INT32 option) if ((UINT8)c & 0x80) //color parsing! -Inuyasha 2.16.09 continue; + if (c < HU_FONTSTART) + continue; // this is not a proper character. + c = toupper(c) - HU_FONTSTART; if (c < 0 || c >= HU_FONTSIZE || !fontv[HU_FONT].font[c]) lw += spacewidth; @@ -3724,6 +3730,9 @@ INT32 V_ThinSubStringWidth(const char *string, INT32 length, INT32 option) if ((UINT8)c & 0x80) //color parsing! -Inuyasha 2.16.09 continue; + if (c < HU_FONTSTART) + continue; // this is not a proper character. + if (!lowercase || !fontv[TINY_FONT].font[c-HU_FONTSTART]) c = toupper(c); c -= HU_FONTSTART;