summaryrefslogtreecommitdiff
path: root/vcl/source/treelist
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-30 09:45:36 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-31 22:08:20 +0200
commit7c49f6c89e7501f4b5ca28a45a91c6cdac5eb01b (patch)
tree13333cdb199b06e9d13ecd069d070057c16171e0 /vcl/source/treelist
parent68730a0e14d2ea37d5aa78bb19d16d5a5ee9d9ae (diff)
cid#1608005 Overflowed constant
Change-Id: Iecc3ff0e7651ec52a2372d383f1d82c454d9dbd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172697 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'vcl/source/treelist')
-rw-r--r--vcl/source/treelist/imap2.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/vcl/source/treelist/imap2.cxx b/vcl/source/treelist/imap2.cxx
index 559658581ca5..f905ca52f533 100644
--- a/vcl/source/treelist/imap2.cxx
+++ b/vcl/source/treelist/imap2.cxx
@@ -282,11 +282,16 @@ void ImageMap::ImpReadCERNLine( std::string_view rLine )
}
else if ( ( aToken == "polygon" ) || ( aToken == "poly" ) )
{
- const sal_uInt16 nCount = comphelper::string::getTokenCount(aStr, '(') - 1;
- tools::Polygon aPoly( nCount );
+ const sal_Int32 nTokenCount = comphelper::string::getTokenCount(aStr, '(');
+ tools::Polygon aPoly;
+ if (nTokenCount > 0)
+ {
+ const sal_uInt16 nCount = nTokenCount - 1;
+ aPoly.SetSize(nCount);
- for ( sal_uInt16 i = 0; i < nCount; i++ )
- aPoly[ i ] = ImpReadCERNCoords( &pStr );
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ aPoly[ i ] = ImpReadCERNCoords( &pStr );
+ }
const OUString aURL = ImpReadCERNURL( &pStr );