diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-10-25 09:33:54 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-10-25 10:38:59 +0200 |
commit | 8b32a3edad52f8ac5e5f0f49b4f4e80954c2fd25 (patch) | |
tree | 45620a9dfdd8492914ae92ca5ff8be0fede6a8d7 /svl | |
parent | 95a9567051c954d5ae552077954bcde27690beb1 (diff) |
Fix stack-use-after-scope
...during CppunitTest_svl_qa_cppunit, after
df42cb6552b20372f62b5a361709670db80e4ed4 "Optimize assignment from
OUStringLiteral to OUString",
> ==918==ERROR: AddressSanitizer: stack-use-after-scope on address 0x2b2e203b5900 at pc 0x2b2e1b9004f8 bp 0x7ffc06726270 sp 0x7ffc06726268
> READ of size 4 at 0x2b2e203b5900 thread T0
> #0 0x2b2e1b9004f7 in void rtl::str::release<_rtl_uString>(_rtl_uString*) /sal/rtl/strtmpl.hxx:1064:9
> #1 0x2b2e1b8d916c in rtl_uString_release /sal/rtl/ustring.cxx:1785:12
> #2 0x2b2e36263ec5 in rtl::OUString::~OUString() /include/rtl/ustring.hxx:493:9
> #3 0x2b2e3622c5ff in (anonymous namespace)::Test::testTdf103060() /svl/qa/unit/svl.cxx:553:1
[...]
> [2304, 2320) 'EXPECTED_G3' (line 550) <== Memory access at offset 2304 is inside this variable
(<https://ci.libreoffice.org/job/lo_ubsan/2176/>).
(aa2064c5c5f23f6f4b7bc44e12345b37f66995bc "Improve loplugin:stringliteralvar"
had failed to introduce those OUStringLiteral variables as static.)
Change-Id: I59168979fcc4b055d17d1d4f315577eef1027505
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124134
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/svl.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 82e18ea91df1..523e998c60c1 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -543,12 +543,10 @@ void Test::testTdf103060() sExpected = "H"; // Heisei era checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected); sCode = "GG"; - constexpr OUStringLiteral EXPECTED_G2 = u"\u5E73"; - sExpected = EXPECTED_G2; + sExpected = u"\u5E73"; checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected); sCode = "GGG"; - constexpr OUStringLiteral EXPECTED_G3 = u"\u5E73\u6210"; - sExpected = EXPECTED_G3; + sExpected = u"\u5E73\u6210"; checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected); } |