diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-29 16:58:11 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-12-21 11:29:30 +0100 |
commit | db092b14692d0d0d81b330de94e66bc55d991250 (patch) | |
tree | bbcecfed79fa75cbe0a58a5c6a19190da2a188e7 /include | |
parent | ofz#37322 Bad-cast (diff) | |
download | core-db092b14692d0d0d81b330de94e66bc55d991250.tar.gz core-db092b14692d0d0d81b330de94e66bc55d991250.zip |
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.hxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/vcl/RawBitmap.hxx b/include/vcl/RawBitmap.hxx index 710559d11d48..5f6c5eecd11f 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) |