cid#1607224 Overflowed return value
Change-Id: I62e153936f9f49fb12deee735ec665bad8a23ad7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174706 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
4a4535300e
commit
a28f9a8cc2
1 changed files with 1 additions and 0 deletions
|
@ -235,6 +235,7 @@ sal_Int32 Drawing::getLocalShapeIndex( std::u16string_view rShapeId ) const
|
||||||
sal_Int32 nBlockId = (nShapeId - 1) / 1024;
|
sal_Int32 nBlockId = (nShapeId - 1) / 1024;
|
||||||
BlockIdVector::iterator aIt = ::std::lower_bound( maBlockIds.begin(), maBlockIds.end(), nBlockId );
|
BlockIdVector::iterator aIt = ::std::lower_bound( maBlockIds.begin(), maBlockIds.end(), nBlockId );
|
||||||
sal_Int32 nIndex = static_cast< sal_Int32 >( aIt - maBlockIds.begin() );
|
sal_Int32 nIndex = static_cast< sal_Int32 >( aIt - maBlockIds.begin() );
|
||||||
|
assert(nIndex < std::numeric_limits<sal_Int32>::max() / 1024 -1 && "possible overflow");
|
||||||
|
|
||||||
// block id not found in set -> register it now (value of nIndex remains valid)
|
// block id not found in set -> register it now (value of nIndex remains valid)
|
||||||
if( (aIt == maBlockIds.end()) || (*aIt != nBlockId) )
|
if( (aIt == maBlockIds.end()) || (*aIt != nBlockId) )
|
||||||
|
|
Loading…
Reference in a new issue