From 28edd61e4092ba63715aebe2a1978d9f6ea4e7b0 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 --- src/SDL_ttf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c index 1397ed1e..ae99f0f1 100644 --- a/src/SDL_ttf.c +++ b/src/SDL_ttf.c @@ -3895,6 +3895,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) {