Skip to content

Commit

Permalink
Prevent negative draw line and out of bounds.
Browse files Browse the repository at this point in the history
can be reproduced with testapp.c, int seed = 1704796537, at iteration ~270
  • Loading branch information
1bsyl committed Jan 9, 2024
1 parent 0a1845b commit 28edd61
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 28edd61

Please sign in to comment.