diff options
| author | Piotr WierciĆski <[email protected]> | 2022-07-27 17:31:52 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-07-27 17:31:52 +0200 |
| commit | 024a803665077b05ae7846b4e4a8ce8c70a306e4 (patch) | |
| tree | 1f30da15625c59d4d2e840778844069455207b11 /src | |
| parent | 5a2f25cc7c7ab7d4600bdc565b9f1da2d9211b4c (diff) | |
| download | raylib-024a803665077b05ae7846b4e4a8ce8c70a306e4.tar.gz raylib-024a803665077b05ae7846b4e4a8ce8c70a306e4.zip | |
rtextures: Improve numerical stability of float multiplication (#2596)
Dimensions of Rectangle should be casted to int before multiplication,
otherwise there is a risk for underallocation/overallocation of memory.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rtextures.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rtextures.c b/src/rtextures.c index 6eb77b7d..39a7a5c0 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -875,7 +875,7 @@ Image ImageFromImage(Image image, Rectangle rec) result.width = (int)rec.width; result.height = (int)rec.height; - result.data = RL_CALLOC((int)(rec.width*rec.height)*bytesPerPixel, 1); + result.data = RL_CALLOC((int)rec.width*(int)rec.height*bytesPerPixel, 1); result.format = image.format; result.mipmaps = 1; |
