summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2022-12-17 11:58:17 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-12-18 15:12:53 +0000
commite896dc133d9aa22b0e568388d190a6cb2f3397ef (patch)
treeffe831c6ed6d5e46e5812b3919b5eafd74d482e3 /i18npool
parent05b714bd902ac061629dc1b95cd4df5c2937dd6d (diff)
tdf#152520: Crash when using TITLE_CASE/SENTENCE_CASE in Transliteration module
relevant part of bt: 7 0x00007f50c85b3796 in com::sun::star::uno::Sequence<int>::realloc(int) (this=0x0, nSize=11) at include/com/sun/star/uno/Sequence.hxx:215 8 0x00007f50c85d9240 in i18npool::transliterate_titlecase_Impl(std::basic_string_view<char16_t, std::char_traits<char16_t> >, int, int, com::sun::star::lang::Locale const&, com::sun::star::uno::Sequence<int>*) (inStr=u"AB cd. eF. ", startPos=0, nCount=11, rLocale=..., pOffset=0x0) at i18npool/source/transliteration/transliteration_body.cxx:267 9 0x00007f50c85d955b in i18npool::Transliteration_sentencecase::transliterateImpl(rtl::OUString const&, int, int, com::sun::star::uno::Sequence<int>*) (this=0x557834ea0bb0, inStr="AB cd. eF. ", startPos=0, nCount=11, pOffset=0x0) at i18npool/source/transliteration/transliteration_body.cxx:298 10 0x00007f50c85dcc10 in i18npool::transliteration_commonclass::transliterateString2String(rtl::OUString const&, int, int) (this=0x557834ea0bb0, inStr="AB cd. eF. ", startPos=0, nCount=11) at i18npool/source/transliteration/transliteration_commonclass.cxx:109 11 0x00007f50c85dcc5d in non-virtual thunk to i18npool::transliteration_commonclass::transliterateString2String(rtl::OUString const&, int, int) () at i18npool/source/transliteration/transliteration_commonclass.cxx:109 12 0x00007f50c85e0d89 in i18npool::TransliterationImpl::transliterateString2String(rtl::OUString const&, int, int) (this=0x557834854dc0, inStr="AB cd. eF. ", startPos=0, nCount=11) at i18npool/source/transliteration/transliterationImpl.cxx:395 full bt here: https://bugs.documentfoundation.org/attachment.cgi?id=184205 Regression from: c7551e8a46e2f9f8142aa7921a0494221ae096e8 (speedup CharacterClassificationImpl::toUpper) Change-Id: I40e383fc87213d88fbde50876f61947b04190a90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144375 (cherry picked from commit 6f7bc75dc1d0fe8227f30afc5eccdd7a9a9c4006) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144365 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/transliteration/transliteration_body.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx
index 69ba0c236714..8bf5d6bdd4b1 100644
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -264,11 +264,14 @@ static OUString transliterate_titlecase_Impl(
// The rest of the text should just become lowercase.
aRes = xCharClassImpl->toTitle( aResolvedLigature, 0, nResolvedLen, rLocale ) +
xCharClassImpl->toLower( aText, 1, aText.getLength() - 1, rLocale );
- pOffset->realloc( aRes.getLength() );
+ if (pOffset)
+ {
+ pOffset->realloc( aRes.getLength() );
- auto [begin, end] = asNonConstRange(*pOffset);
- sal_Int32* pOffsetInt = std::fill_n(begin, nResolvedLen, 0);
- std::iota(pOffsetInt, end, 1);
+ auto [begin, end] = asNonConstRange(*pOffset);
+ sal_Int32* pOffsetInt = std::fill_n(begin, nResolvedLen, 0);
+ std::iota(pOffsetInt, end, 1);
+ }
}
return aRes;
}