Fixed bug libsdl-org#6745 - Check for overflow in SDL_CalculateYUVSize (#6747)

Fixed bug #6745 - Check for overflow in SDL_CalculateYUVSize
This commit is contained in:
Sylvain Becker
2022-12-03 21:22:14 +01:00
committed by GitHub
parent 5650046f93
commit 4ffa7f868d
3 changed files with 137 additions and 29 deletions

View File

@@ -58,7 +58,10 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
swdata->h = h;
{
size_t dst_size;
SDL_CalculateYUVSize(format, w, h, &dst_size, NULL);
if (SDL_CalculateYUVSize(format, w, h, &dst_size, NULL) < 0) {
SDL_OutOfMemory();
return NULL;
}
swdata->pixels = (Uint8 *)SDL_SIMDAlloc(dst_size);
if (!swdata->pixels) {
SDL_SW_DestroyYUVTexture(swdata);