vcl/inc/opengl/salbmp.hxx | 2 +- vcl/opengl/salbmp.cxx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
New commits: commit 535c319c9e37bcdb70749326e09d1963d34df25a Author: Caolán McNamara <[email protected]> Date: Mon Mar 19 15:32:08 2018 +0000 coverity#1430079 Overflowed return value Change-Id: I623f9f317496f281af408d1418d3cc7f2bd2d412 Reviewed-on: https://gerrit.libreoffice.org/51569 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx index f44176c24e80..68d79d8af404 100644 --- a/vcl/inc/opengl/salbmp.hxx +++ b/vcl/inc/opengl/salbmp.hxx @@ -41,7 +41,7 @@ private: BitmapPalette maPalette; std::shared_ptr<sal_uInt8> mpUserBuffer; sal_uInt16 mnBits; - sal_uInt16 mnBytesPerRow; + sal_uInt32 mnBytesPerRow; int mnWidth; int mnHeight; diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index fab0f6d724d4..a83c2c820e0f 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -79,7 +79,7 @@ inline bool isValidBitCount( sal_uInt16 nBitCount ) return (nBitCount == 1) || (nBitCount == 4) || (nBitCount == 8) || (nBitCount == 16) || (nBitCount == 24) || (nBitCount == 32); } -sal_uInt16 lclBytesPerRow(sal_uInt16 nBits, int nWidth) +sal_uInt32 lclBytesPerRow(sal_uInt16 nBits, int nWidth) { assert ((nBits == 1 || nBits == 4 || nBits == 8 || nBits == 16 || nBits == 24 || nBits == 32) && "vcl::OpenGLSalBitmap::AllocateUserData(), illegal bitcount!"); @@ -256,7 +256,7 @@ bool OpenGLSalBitmap::AllocateUserData() { try { - size_t nToAllocate = static_cast<sal_uInt32>(mnBytesPerRow) * mnHeight; + size_t nToAllocate = mnBytesPerRow * mnHeight; #if OSL_DEBUG_LEVEL > 0 nToAllocate += sizeof(CANARY); #endif @@ -580,7 +580,7 @@ bool OpenGLSalBitmap::ReadTexture() #if OSL_DEBUG_LEVEL > 0 // If we read over the end of pData we have a real hidden memory // corruption problem ! - size_t nCanary = static_cast<sal_uInt32>(mnBytesPerRow) * mnHeight; + size_t nCanary = mnBytesPerRow * mnHeight; assert(!memcmp(pData + nCanary, CANARY, sizeof (CANARY))); #endif return true; @@ -592,7 +592,7 @@ bool OpenGLSalBitmap::ReadTexture() sal_uInt8* pBuffer = aBuffer.data(); determineTextureFormat(24, nFormat, nType); maTexture.Read(nFormat, nType, pBuffer); - sal_uInt16 nSourceBytesPerRow = lclBytesPerRow(24, mnWidth); + sal_uInt32 nSourceBytesPerRow = lclBytesPerRow(24, mnWidth); std::unique_ptr<ScanlineWriter> pWriter; switch(mnBits) @@ -757,7 +757,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode ) mpUserBuffer.reset(); AllocateUserData(); - memcpy(mpUserBuffer.get(), aBuffer.get(), static_cast<sal_uInt32>(mnBytesPerRow) * mnHeight); + memcpy(mpUserBuffer.get(), aBuffer.get(), mnBytesPerRow * mnHeight); } BitmapBuffer* pBuffer = new BitmapBuffer; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
