tdf#158837 hyphenation crash in: int rtl::str::indexOfStr_WithLength
the code was already dodgy, passing in an invalid nPos, which triggers
an assert.
However, it appears that previously that dodginess was ignored, until
commit 5ebccaa075
author Noel Grandin Sat Apr 10 17:27:08 2021 +0200
use std lib for O[U]String indexOfStr
which turned it into a crash.
Add a check to avoid the crash, no idea what the right fix would look
like.
Change-Id: I826b9af0b2d9c7c297214ce2d54c664fb573edd2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161271
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -171,6 +171,8 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl()
|
||||
aLeft = aLeft.replaceFirst( aTmp, "", &nPos );
|
||||
if (nPos != -1)
|
||||
++m_nHyphenationPositionsOffset;
|
||||
if (nPos >= aLeft.getLength()) // tdf#158837
|
||||
break;
|
||||
}
|
||||
aTxt = aTxt.replaceAt( 0, nPos2, aLeft );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user