From 073da22002e07da48491e8c8e71a6e2895efaaaa Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 9 Jan 2024 15:17:37 +0100 Subject: [PATCH] Prevent negative draw line and out of bounds. can be reproduced with testapp.c, int seed = 1704796537, at iteration ~270 --- SDL_ttf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/SDL_ttf.c b/SDL_ttf.c index 41534b9a..1a3ebccf 100644 --- a/SDL_ttf.c +++ b/SDL_ttf.c @@ -3921,6 +3921,7 @@ static SDL_Surface* TTF_Render_Wrapped_Internal(TTF_Font *font, const char *text } else { xoffset = 0; } + xoffset = SDL_max(0, xoffset); /* Render one text line to textbuf at (xstart, ystart) */ if (Render_Line(render_mode, font->render_subpixel, font, textbuf, xstart + xoffset, ystart, fg) < 0) {