REVIEWED: possible overflow... again #4206
Some checks failed
Android / build (arm64) (push) Has been cancelled
Android / build (x86_64) (push) Has been cancelled
CMakeBuilds / Windows Build (push) Has been cancelled
CMakeBuilds / Linux Build (push) Has been cancelled
Linux / build (i386, i386, /user/bin, 32) (push) Has been cancelled
Linux / build (x86_64, amd64, /user/bin, 64) (push) Has been cancelled
Linux Examples / build (push) Has been cancelled
macOS / build (push) Has been cancelled
WebAssembly / build (push) Has been cancelled
Windows / build (i686, pe-i386, 32, mingw-w64) (push) Has been cancelled
Windows / build (x64, x64, 64, msvc16) (push) Has been cancelled
Windows / build (x86, Win32, 32, msvc16) (push) Has been cancelled
Windows / build (x86_64, pe-x86-64, 64, mingw-w64) (push) Has been cancelled
Windows Examples / build (push) Has been cancelled

This commit is contained in:
Ray 2024-08-04 23:22:27 +02:00
parent 923f983719
commit 9c2ba3bfb7
2 changed files with 4 additions and 4 deletions

View File

@ -4993,8 +4993,8 @@ static int rlGetPixelDataSize(int width, int height, int format)
default: break;
}
char bytesPerPixel = bpp/8;
dataSize = width*height*bytesPerPixel; // Total data size in bytes
float bytesPerPixel = (float)bpp/8.0f;
dataSize = (int)(bytesPerPixel*width*height); // Total data size in bytes
// Most compressed formats works on 4x4 blocks,
// if texture is smaller, minimum dataSize is 8 or 16

View File

@ -5403,8 +5403,8 @@ int GetPixelDataSize(int width, int height, int format)
default: break;
}
char bytesPerPixel = bpp/8;
dataSize = width*height*bytesPerPixel; // Total data size in bytes
float bytesPerPixel = (float)bpp/8.0f;
dataSize = (int)(bytesPerPixel*width*height); // Total data size in bytes
// Most compressed formats works on 4x4 blocks,
// if texture is smaller, minimum dataSize is 8 or 16