diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-05-18 20:06:21 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-05-19 07:08:46 +0200 |
commit | 971c9945825db02a4809538d26fff3ae77d16866 (patch) | |
tree | 0264e0ebe1ef376c98e0dda9057fda5859bddae3 /include | |
parent | 261063e69e80193ad563e086c515fd6e22e48464 (diff) |
Fix "AddressSanitizer: heap-use-after-free"
https://github.com/CollaboraOnline/online/issues/6380
Commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a (sw_redlinehide_4a:
SwEditShell::AutoCorrect() etc., 2018-11-28) explicitly relied upon
the reference to the node text being updated on editing operations.
Commit 14f6700fefa945c4cf995c09af9326c2a022f886 (use more string_view
in editeng, 2022-04-14) converted the argument of FnChgToEnEmDash to
a string view, which means that any change in the underlying OUString
frees the memory referenced by the view.
But in this method, we really don't want to have the text updated;
so use a local OUString copy for later reference.
Partially revert commit 14f6700fefa945c4cf995c09af9326c2a022f886.
And copy mst's commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a
message to document the assumptions in SwEditShell::AutoCorrect.
Change-Id: I0ff02958c8de9566d774f366d905aa9bb603055c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151970
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/svxacorr.hxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index fcb5f97aca2b..a5e43032a78f 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -408,7 +408,7 @@ public: bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const OUString&, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ); - bool FnChgToEnEmDash( SvxAutoCorrDoc&, std::u16string_view, + bool FnChgToEnEmDash( SvxAutoCorrDoc&, const OUString&, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ); bool FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view, |