Skip to content

Commit

Permalink
Update for new names and return types of overflow-checked add/multiply
Browse files Browse the repository at this point in the history
  • Loading branch information
smcv committed Sep 3, 2024
1 parent d4b137f commit 7aba643
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,14 +1422,14 @@ static SDL_Surface *AllocateAlignedPixels(size_t width, size_t height, SDL_Pixel
*/
if (width > SDL_MAX_SINT32 ||
height > SDL_MAX_SINT32 ||
SDL_size_add_overflow(width, alignment, &pitch) ||
SDL_size_mul_overflow(pitch, bytes_per_pixel, &pitch) ||
!SDL_size_add_check_overflow(width, alignment, &pitch) ||
!SDL_size_mul_check_overflow(pitch, bytes_per_pixel, &pitch) ||
pitch > SDL_MAX_SINT32) {
return NULL;
}
pitch &= ~alignment;

if (SDL_size_mul_overflow(height, pitch, &size)) {
if (!SDL_size_mul_check_overflow(height, pitch, &size)) {
/* Overflow... */
return NULL;
}
Expand Down

0 comments on commit 7aba643

Please sign in to comment.