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:
Noel Grandin 2024-10-08 19:18:07 +02:00 committed by Noel Grandin
parent 4a4535300e
commit a28f9a8cc2

View file

@ -235,6 +235,7 @@ sal_Int32 Drawing::getLocalShapeIndex( std::u16string_view rShapeId ) const
sal_Int32 nBlockId = (nShapeId - 1) / 1024;
BlockIdVector::iterator aIt = ::std::lower_bound( maBlockIds.begin(), maBlockIds.end(), nBlockId );
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)
if( (aIt == maBlockIds.end()) || (*aIt != nBlockId) )