fix HU_FONTSIZE checks (#2044)

This commit is contained in:
Roman Fomin 2024-11-23 18:29:34 +07:00 committed by GitHub
parent 0fd37165ff
commit e62cb98ce8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

@ -389,7 +389,7 @@ void F_TextWrite (void)
}
c = M_ToUpper(c) - HU_FONTSTART;
if (c < 0 || c> HU_FONTSIZE || hu_font[c] == NULL)
if (c < 0 || c >= HU_FONTSIZE || hu_font[c] == NULL)
{
cx += 4;
continue;
@ -618,7 +618,7 @@ void F_CastPrint (char* text)
if (!c)
break;
c = M_ToUpper(c) - HU_FONTSTART;
if (c < 0 || c> HU_FONTSIZE || hu_font[c] == NULL)
if (c < 0 || c >= HU_FONTSIZE || hu_font[c] == NULL)
{
width += 4;
continue;
@ -637,7 +637,7 @@ void F_CastPrint (char* text)
if (!c)
break;
c = M_ToUpper(c) - HU_FONTSTART;
if (c < 0 || c> HU_FONTSIZE || hu_font[c] == NULL)
if (c < 0 || c >= HU_FONTSIZE || hu_font[c] == NULL)
{
cx += 4;
continue;

View File

@ -3685,7 +3685,7 @@ void MN_DrawStringCR(int cx, int cy, byte *cr1, byte *cr2, const char *ch)
}
c = M_ToUpper(c) - HU_FONTSTART;
if (c < 0 || c > HU_FONTSIZE || hu_font[c] == NULL)
if (c < 0 || c >= HU_FONTSIZE || hu_font[c] == NULL)
{
cx += SPACEWIDTH; // space
continue;
@ -3778,7 +3778,7 @@ int MN_GetPixelWidth(const char *ch)
}
c = M_ToUpper(c) - HU_FONTSTART;
if (c < 0 || c > HU_FONTSIZE)
if (c < 0 || c >= HU_FONTSIZE || hu_font[c] == NULL)
{
len += SPACEWIDTH; // space
continue;

View File

@ -814,7 +814,7 @@ static void UpdateLines(sbarelem_t *elem)
if (font->type == sbf_proportional)
{
ch = M_ToUpper(ch) - HU_FONTSTART;
if (ch < 0 || ch > HU_FONTSIZE)
if (ch < 0 || ch >= HU_FONTSIZE)
{
totalwidth += SPACEWIDTH;
continue;
@ -1324,7 +1324,7 @@ static void DrawLines(int x, int y, sbarelem_t *elem)
ch = M_ToUpper(ch) - HU_FONTSTART;
patch_t *glyph;
if (ch < 0 || ch > HU_FONTSIZE)
if (ch < 0 || ch >= HU_FONTSIZE)
{
glyph = NULL;
}