Fix pixel data size regressions (#5984)

Co-authored-by: gideons <gse@newspacesystems.com>
This commit is contained in:
GideonSerf 2026-07-16 12:07:19 +02:00 • committed by GitHub
commit a9a0c046f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2693,8 +2693,9 @@ void ImageRotate(Image *image, int degrees)
int width = (int)(fabsf(image->width*cosRadius) + fabsf(image->height*sinRadius));
int height = (int)(fabsf(image->height*cosRadius) + fabsf(image->width*sinRadius));
int bytesPerPixel = GetPixelDataSize(width, height, image->format);
unsigned char *rotatedData = (unsigned char *)RL_CALLOC(bytesPerPixel, 1);
int dataSize = GetPixelDataSize(width, height, image->format);
int bytesPerPixel = GetPixelDataSize(1, 1, image->format);
unsigned char *rotatedData = (unsigned char *)RL_CALLOC(dataSize, 1);
if (rotatedData != NULL)
{
@ -5514,7 +5515,7 @@ int GetPixelDataSize(int width, int height, int format)
default: break;
}
unsigned long long dataSizeBytes = (width*height*bpp) >> 3; // Get size in bytes (dividing by 8)
unsigned long long dataSizeBytes = ((unsigned long long)width*height*bpp) >> 3; // Get size in bytes (dividing by 8)
if (dataSizeBytes < INT_MAX)
{