diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-12-24 19:14:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-12-24 20:46:20 +0100 |
commit | a89a42e55f2b154c8b276fe08fcf02c4b9fc0945 (patch) | |
tree | cd8b59f1df82aa0e9fe72138f9bf11011ae8bbbc /cui/source | |
parent | 8b46faa59ecc988c79890ddd2a166f5317a93958 (diff) |
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 5ebccaa07589383653dbd65e58204a82dd3cde09
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>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/hyphen.cxx | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index 259ec5d03395..10ad1d9bba5b 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -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 ); } |