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 da84bce commit 073da22
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 073da22

Please sign in to comment.