From cfded96627cd5906c55b8d47112b8e00bd0c8c44 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 17 Mar 2019 12:19:53 +0100 Subject: [PATCH] fixing truncation error in GetSubBitmap fixes #18362 --- src/osx/core/bitmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index fcfb40816b..004b67c347 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -1026,8 +1026,8 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const { int sourcelinesize = GetBitmapData()->GetBytesPerRow() ; int destlinesize = ret.GetBitmapData()->GetBytesPerRow() ; - unsigned char *source = sourcedata + int(rect.x * scale * 4 + rect.y *scale * sourcelinesize) ; - unsigned char *dest = destdata ; + unsigned char* source = sourcedata + size_t(rect.x * scale) * 4 + size_t(rect.y * scale) * sourcelinesize; + unsigned char* dest = destdata; for (int yy = 0; yy < destheight; ++yy, source += sourcelinesize , dest += destlinesize) {