Bug 158703 - Crash if I use the space bar several times and then punctuation (French Locale)
Summary: Crash if I use the space bar several times and then punctuation (French Locale)
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.8.0 target:24.2.0.0.beta2 t...
Keywords: haveBacktrace
: 158529 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-12-14 14:54 UTC by rose.thibout
Modified: 2023-12-19 20:03 UTC (History)
5 users (show)

See Also:
Crash report or crash signature: ["rtl::str::release%3C_rtl_uString%3E(_rtl_uString%20*)"]


Attachments
bt with debug symbols (7.45 KB, text/plain)
2023-12-16 16:35 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rose.thibout 2023-12-14 14:54:19 UTC
Description:
LibreOffice crashes when I try to make a space using the space bar and then put a : or a ! or a ;

Steps to Reproduce:
1.click several time and the space bar
2.put a : or ; or !

Actual Results:
LibreOffice crash

Expected Results:
Just write "     :"


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: threaded
Comment 1 m_a_riosv 2023-12-14 21:47:22 UTC
I can't reproduce the issue:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL threaded
Comment 2 rose.thibout 2023-12-15 07:33:24 UTC
You must click at least 6 times on the space bar and then put a :

Then libreoffice crash
Comment 3 Xisco Faulí 2023-12-15 07:55:14 UTC
I can't reproduce it in

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 0f82e9d42822e627edd1fb3b3c87e1f8a22136a4
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

Thank you for reporting the bug. To be certain the reported issue is not related to corruption in the user profile, could you please reset your Libreoffice profile ( https://wiki.documentfoundation.org/UserProfile ) and re-test?

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the issue is still present
Comment 4 rose.thibout 2023-12-15 08:08:41 UTC
 ran the test on 3 different computers (laptop and desktop) and reset the user profile, nothing changed.
Comment 5 m_a_riosv 2023-12-15 22:15:57 UTC
Again, I can't reproduce with:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
Comment 6 Julien Nabet 2023-12-16 16:35:40 UTC
Created attachment 191461 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I got an assertion.
Comment 7 Julien Nabet 2023-12-16 16:37:22 UTC
I also got a crash with LO Debian package 7.6.4.1, I got a crash and noticed these logs:
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string_view::substr: __pos (which is 4) > __size (which is 3)
Unspecified Application Error
Comment 8 Julien Nabet 2023-12-16 17:29:51 UTC
It's specific to French UI since LO goes into SvxAutoCorrect::FnAddNonBrkSpace and rTxt is changed afterwards.
Comment 9 Julien Nabet 2023-12-16 18:26:55 UTC
It resembles the pb which has been fixed with 971c9945825db02a4809538d26fff3ae77d16866

1) const OUString& rTxt which had been replaced with std::u16string_view rTxt
2) as Mike indicated:
// rTxt may refer to the frame text that will change in the calls to rDoc.Delete / rDoc.Insert;
// keep a local copy for later use
OUString aOrigTxt = rTxt;

I tried to apply the same but it still crashes.
After this part:
    730                     if ( nEndPos - nPos > 0 )
    731                         rDoc.Delete( nPos, nEndPos ); 

rTxt has a smaller size whereas nEndPos hasn't changed so crash.

No idea what to do.
Comment 10 Xisco Faulí 2023-12-18 12:03:51 UTC
Also reproduced in

Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: c94961c6869c34b3874d21cfaa5ec1488609acfe
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: fr-FR (es_ES.UTF-8); UI: en-US
Calc: threaded

it's important to use the French locale
Comment 11 Xisco Faulí 2023-12-18 12:24:06 UTC
(In reply to Julien Nabet from comment #9)
> It resembles the pb which has been fixed with
> 971c9945825db02a4809538d26fff3ae77d16866
> 
> 1) const OUString& rTxt which had been replaced with std::u16string_view rTxt
> 2) as Mike indicated:
> // rTxt may refer to the frame text that will change in the calls to
> rDoc.Delete / rDoc.Insert;
> // keep a local copy for later use
> OUString aOrigTxt = rTxt;
> 
> I tried to apply the same but it still crashes.
> After this part:
>     730                     if ( nEndPos - nPos > 0 )
>     731                         rDoc.Delete( nPos, nEndPos ); 
> 
> rTxt has a smaller size whereas nEndPos hasn't changed so crash.
> 
> No idea what to do.

Hi Mike,
I thought you might be interested in this issue
Comment 12 Mike Kaganski 2023-12-18 14:53:23 UTC
https://gerrit.libreoffice.org/c/core/+/160924

French locale is not required: the only required thing is French text (so it initiates specific autocorrection rules).
Comment 13 Commit Notification 2023-12-18 17:46:39 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1325d66a7f8657aaf9951a0664fbf14cca86905b

tdf#158703: return updated position from FnAddNonBrkSpace

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2023-12-19 08:38:41 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/64e371c6db51a2be53e0436b762fd96e84f49e04

tdf#158703: return updated position from FnAddNonBrkSpace

It will be available in 24.2.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2023-12-19 15:26:59 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/7eac2d2fded789a3dd64b738d816ce0b6270decc

tdf#158703: return updated position from FnAddNonBrkSpace

It will be available in 7.6.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Xisco Faulí 2023-12-19 16:54:32 UTC
*** Bug 158529 has been marked as a duplicate of this bug. ***
Comment 17 ady 2023-12-19 17:48:54 UTC Comment hidden (off-topic)
Comment 18 Mike Kaganski 2023-12-19 17:51:55 UTC Comment hidden (off-topic)
Comment 19 ady 2023-12-19 19:54:44 UTC Comment hidden (off-topic)
Comment 20 Julien Nabet 2023-12-19 20:03:04 UTC
With master sources updated today (included Mike's patch), I confirm I don't reproduce the crash.
Thank you Mike! :-)