Bug 160346 - A huge floating table in header makes Writer hang
Summary: A huge floating table in header makes Writer hang
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.0.5 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest, regression
Depends on:
Blocks: DOCX-Floatingtable
  Show dependency treegraph
 
Reported: 2024-03-25 05:14 UTC by Mike Kaganski
Modified: 2024-04-15 19:29 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
A sample DOCX with a huge floating table in a header (16.55 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-03-25 05:14 UTC, Mike Kaganski
Details
A table cell with multiple paragraphs in a header (3.90 KB, application/vnd.oasis.opendocument.text)
2024-03-25 06:11 UTC, Mike Kaganski
Details
Sample of LibreOffice after .docx finally loads and then hangs (4.35 MB, text/plain)
2024-04-02 23:13 UTC, Patrick Luby (volunteer)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-03-25 05:14:54 UTC
Created attachment 193279 [details]
A sample DOCX with a huge floating table in a header

In MS Word:

1. Create a new document;
2. Type 'foo', to make a non-empty body;
3. Add a header;
4. In the header, insert a table with 100 rows;
5. In that table's properties, set "Text wrapping"->"Around";
6. Save as a DOCX.

Try to open the DOCX in Writer.

In v.4.4, this opened without a hang.
Starting with v.5.0, it hangs.
Comment 1 Mike Kaganski 2024-03-25 06:11:25 UTC
Created attachment 193280 [details]
A table cell with multiple paragraphs in a header

Another infinite layout loop, possibly related. This one allows interaction with the document while looping, though.
Comment 2 wjsim 2024-03-25 14:40:31 UTC
Thank you for reporting the bug.

When I try to open the sample DOCX with a huge floating table in the header, it doesn't open and freezes up, forcing me to end the process. I tried a new document with the steps to reproduce, and I seem to have no issues with opening it.

Version: 24.2.1.2 (X86_64) / LibreOffice Community
Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
CPU threads: 16; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6a064b1967e06e40be40817deff99d00c1a8554f
CPU threads: 16; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: ko-KR (en_US); UI: en-US
Calc: CL threaded
Comment 3 Mike Kaganski 2024-03-25 15:18:49 UTC
(In reply to wjsim from comment #2)
> I tried a new document with the steps to reproduce, and I seem to have no issues
> with opening it.

That means that you missed a step - e.g., step 5 could be a suspect.
Comment 4 Haris 2024-03-29 05:02:41 UTC
Hello Mike Kaganski,

When I tried opening the sample DOCX file with a huge floating table in a header, I'm unable to open it in both the stable and master/daily build. Just like wsjim, I had to force quit both applications as they had stopped responding. 

I used the following two builds:

Stable Build
Version: 24.2.1.2 (AARCH64) / LibreOffice Community
Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
CPU threads: 10; OS: macOS 14.1.2; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Master/Daily Build
Version: 24.8.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: c4023d3ec604abfff38be2053e2989c7ec2ba8c1
CPU threads: 10; OS: macOS 14.1.2; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 5 Mike Kaganski 2024-03-29 05:05:23 UTC
(In reply to Haris from comment #4)

Indeed; that is the issue here. The title of this bug is "A huge floating table in header makes Writer hang". it is intended to say that the program hangs (freezes). Obvious, isn't it?
Comment 6 Haris 2024-03-29 05:06:33 UTC
Since both wjsim and I can both reproduce it, I'm setting this to 'NEW'.
Comment 7 Patrick Luby (volunteer) 2024-04-02 23:13:12 UTC
Created attachment 193450 [details]
Sample of LibreOffice after .docx finally loads and then hangs
Comment 8 Patrick Luby (volunteer) 2024-04-02 23:18:39 UTC
With the following debug patch, I got attachment #193279 [details] to load. Then, a see a hang for 1 to 2 minutes if I click in an unselected cell (see sample in attachment #193450 [details]):

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 3e9ca93b3380..52d4093325ef 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2298,7 +2298,9 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
                               -m_aCharRect.Width() : m_aCharRect.Height());
         }
 
-        if( !bFirst && aOld == m_aCharRect )
+        // In tdf#160346, the width and height in both rectangles are 1 but
+        // X is the same, and Y is different. Maybe a pattern?
+        if( !bFirst && ( aOld == m_aCharRect || ( m_aCharRect.Width() <= 1 && m_aCharRect.Height() <= 1 ) ) )
             break;
 
         // if the layout says that we are after the 100th iteration still in
Comment 9 Aron Budea 2024-04-15 19:29:49 UTC
Concerning bibisect, it doesn't hang in latest of bibisect-50max, but hangs in oldest of bibisect-linux-64-5.2, needs to be bibisected on Windows.