SDL_ttf: Prevent infinite recursion in TTF_RenderGlyph_Solid on Linux when using TrueType rendering

From 35cd5c89d002280daa27c319e89a35c780afe457 Mon Sep 17 00:00:00 2001
From: Gustavo Ribeiro Croscato <[EMAIL REDACTED]>
Date: Sat, 21 Dec 2024 13:12:03 -0300
Subject: [PATCH] Prevent infinite recursion in TTF_RenderGlyph_Solid on Linux
 when using TrueType rendering

Fixes #441
---
 src/SDL_ttf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index ec142f55..558dad20 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -3111,6 +3111,10 @@ static bool TTF_Size_Internal(TTF_Font *font, const char *text, size_t length, i
         if (c == UNICODE_BOM_NATIVE || c == UNICODE_BOM_SWAPPED) {
             continue;
         }
+
+        if (c == 0 && length > 0) {
+            --length;
+        }
 #endif
         if (!Find_GlyphByIndex(font, idx, 0, 0, 0, 0, 0, 0, &glyph, NULL)) {
             goto failure;