Bug 163543 - File crash in LibreOffice Writer when selecting and copying content
Summary: File crash in LibreOffice Writer when selecting and copying content
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.8.2.1 release
Hardware: All All
: highest critical
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0 target:24.8.3
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-20 11:39 UTC by Amin Irgaliev
Modified: 2024-10-24 11:17 UTC (History)
2 users (show)

See Also:
Crash report or crash signature: ["static%20void%20sw::%60anonymous%20namespace'::TextFormattingCheck::check(class%20SwNode%20*)"]


Attachments
Playback Steps (1.56 MB, video/mp4)
2024-10-20 11:41 UTC, Amin Irgaliev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amin Irgaliev 2024-10-20 11:39:34 UTC
Description:
The file crashes when copying the selected document fragment not from the beginning of the line with the transition to the next paragraph, if was open the "Accessibility check" tab.

It looks like the problem is in lines like this:
SwWrtShell* pWrtShell = rDocument.GetDocShell()->GetWrtShell();

In the problematic case, rDocument.GetDocShell() returns nullptr, which causes the program to crash when calling GetWrtShell(). Perhaps the code needs an additional check for nullptr, as is done here, a little lower:

SwDocShell* pShell = pDoc->GetDocShell();
  if (!pShell)
    return;

Steps to Reproduce:
1. Open the file.odt or .docx
2. Open the "Accessibility check" tab
3. Select several paragraphs of the text, starting not from the beginning of the line
4. Try to copy the selected text

Actual Results:
The file is crashing

Expected Results:
The text is being copied


Reproducible: Always


User Profile Reset: No

Additional Info:
Previously, we wrote in the related PR: Bug tdf#162889, but decided to create a new one, because there is no promotion.

First repro on master:
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 245a20b6093237fc247f9515e37dc70556448812
CPU threads: 12; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: ru-RU (ru_RU.UTF-8); UI: en-US
Calc: CL threaded
Comment 1 Amin Irgaliev 2024-10-20 11:41:02 UTC
Created attachment 197166 [details]
Playback Steps
Comment 2 Xisco Faulí 2024-10-21 13:36:26 UTC
Most reported crash at the moment, Increasing importance
Comment 3 Xisco Faulí 2024-10-21 14:03:08 UTC
My take on it: https://gerrit.libreoffice.org/c/core/+/175338
Comment 4 Balázs Varga (allotropia) 2024-10-21 14:08:35 UTC
(In reply to Xisco Faulí from comment #3)
> My take on it: https://gerrit.libreoffice.org/c/core/+/175338

Thanks a lot Xisco for fixing it.
Comment 5 Xisco Faulí 2024-10-21 14:19:34 UTC
(In reply to Balázs Varga (allotropia) from comment #4)
> (In reply to Xisco Faulí from comment #3)
> > My take on it: https://gerrit.libreoffice.org/c/core/+/175338
> 
> Thanks a lot Xisco for fixing it.

Hi Balázs,
I'm very sorry I didn't realize the ticket was already assigned to you. I hope i'm not stepping on your toes on this...
Comment 6 Commit Notification 2024-10-21 15:43:08 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c796878e6af0fc7c886e813a0010d9402312eb5c

tdf#163543: check GetDocShell()

It will be available in 25.2.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 7 Commit Notification 2024-10-22 09:46:31 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/e827d051971a331c16bca8a58ab1c921736810ee

tdf#163543: check GetDocShell()

It will be available in 24.8.3.

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.