summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-29 16:58:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-08-29 20:39:00 +0200
commit72da4c623baf60eb2b7073697cd36ffb3022847d (patch)
tree8f7661bb44d0fc9c10589bf2142f9ca7f51c1a78 /include
parent9f9d075f3f814a2c6c53063cb7f3a582f6bff514 (diff)
ofz#37796 limit to numeric_limits<int>::max
Change-Id: I6e09226fad1e566ba2758d0084042b603b84d221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121230 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/RawBitmap.hxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/vcl/RawBitmap.hxx b/include/vcl/RawBitmap.hxx
index b26d532a4032..19fe94cd2c59 100644
--- a/include/vcl/RawBitmap.hxx
+++ b/include/vcl/RawBitmap.hxx
@@ -31,6 +31,10 @@ public:
, mnBitCount(nBitCount)
{
assert(nBitCount == 24 || nBitCount == 32);
+ if (rSize.getWidth() > std::numeric_limits<sal_Int32>::max() || rSize.getWidth() < 0)
+ throw std::bad_alloc();
+ if (rSize.getHeight() > std::numeric_limits<sal_Int32>::max() || rSize.getHeight() < 0)
+ throw std::bad_alloc();
sal_Int32 nRowSize, nDataSize;
if (o3tl::checked_multiply<sal_Int32>(rSize.getWidth(), nBitCount / 8, nRowSize)
|| o3tl::checked_multiply<sal_Int32>(nRowSize, rSize.getHeight(), nDataSize)