diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-26 21:06:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-28 13:12:37 +0200 |
commit | 17181dfd0ff3abed78f00b5812e9652a8344bab9 (patch) | |
tree | cd62fad60c92869dd48c06dd2bfd61e686b07185 /vcl/source/treelist | |
parent | d2e937d93f0646480d92101115e5b4a4f41f2acc (diff) |
cid#1606906 Overflowed constant
Change-Id: I8ac1aabb50c5ef061b8ac359cb9d7ce8fe66c62c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172511
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'vcl/source/treelist')
-rw-r--r-- | vcl/source/treelist/imap2.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/vcl/source/treelist/imap2.cxx b/vcl/source/treelist/imap2.cxx index c49aa45b5e6e..559658581ca5 100644 --- a/vcl/source/treelist/imap2.cxx +++ b/vcl/source/treelist/imap2.cxx @@ -416,12 +416,17 @@ void ImageMap::ImpReadNCSALine( std::string_view rLine ) } else if ( aToken == "poly" ) { - const sal_uInt16 nCount = comphelper::string::getTokenCount(aStr, ',') - 1; + const sal_Int32 nTokenCount = comphelper::string::getTokenCount(aStr, ','); const OUString aURL( ImpReadNCSAURL( &pStr ) ); - tools::Polygon aPoly( nCount ); + 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 ] = ImpReadNCSACoords( &pStr ); + for (sal_uInt16 i = 0; i < nCount; ++i) + aPoly[ i ] = ImpReadNCSACoords( &pStr ); + } maList.emplace_back( new IMapPolygonObject( aPoly, aURL, OUString(), OUString(), OUString(), OUString() ) ); } |