Bug 55185 - FILEOPEN: hang when opening particular Word document
Summary: FILEOPEN: hang when opening particular Word document
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
3.3.0 release
Hardware: Other All
: medium major
Assignee: Not Assigned
Whiteboard: BSA
Depends on:
Blocks: DOC-Opening
  Show dependency treegraph
Reported: 2012-09-21 08:57 UTC by libreoffice
Modified: 2022-11-08 10:45 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

Word document that hangs when opened (68.00 KB, application/msword)
2012-09-21 08:57 UTC, libreoffice
Crude hack to prevent hang (889 bytes, patch)
2012-09-21 08:59 UTC, libreoffice
Mac OS X log file created on forced quit on hang (158.82 KB, text/plain)
2012-09-26 13:07 UTC, Roman Eisele
Microsoft Word - libo_hang_sec2011_502RT2003.pdf: just for an idea of what is inside. (7.27 KB, application/pdf)
2020-04-17 14:01 UTC, Justin L

Note You need to log in before you can comment on or make changes to this bug.
Description libreoffice 2012-09-21 08:57:20 UTC
Created attachment 67485 [details]
Word document that hangs when opened

LibreOffice hangs when opening the attached Word document. This is a reduced 32-character version of http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=SEC:2011:0502:FIN:EN:DOC.

Steps to reproduce:
1. open document

Current behavior:

Expected behavior:
open document

Linux Ubuntu 10.04 i686 LibreOffice from git
Windows 7 x64 LibreOffice i686

The problem seems to be a never ending loop in SwTxtFormatter::BuildPortions.
Comment 1 libreoffice 2012-09-21 08:59:24 UTC
Created attachment 67486 [details]
Crude hack to prevent hang
Comment 2 Roman Eisele 2012-09-26 13:06:32 UTC
Thank you very much for your bug report!

Not a new problem; REPRODUCIBLE with
* LibreOffice 3.3.0
* LibreOffice 3.4.6
* LibreOffice
* LibreOffice
all on Mac OS X 10.6.8.

Therefore adjusted Version field (should always contain the 1st version in which a bug is reproducible).

Thank you especially for the “crude hack” which at least shows where the problem is!
Comment 3 Roman Eisele 2012-09-26 13:07:31 UTC
Created attachment 67725 [details]
Mac OS X log file created on forced quit on hang

The log file (with simple stack trace) created by Mac OS X when I had to force quit LibO because of the hang.
Comment 4 Roman Eisele 2012-09-26 13:14:24 UTC
@ Writer experts:

Hello Cédric, hello Michael,

this is a bug report about a .doc file which causes a hang when opening it in LibreOffice. I know that this is not the only report of that kind, but the GOOD thing here is that the reporter

a) has already managed to strip down the .doc file to a minimum,
   so that you can analyse what causes the hang; and

b) has even provided a “crude hack” patch which prevents the hang and,
   even if it is not suitable for pushing to master,
   at least seems to show exactly where the bug is.

So please take a look at this report; at least a simple-minded bug wrangler like me would hope that with the excellent hints already given here it should be possible to fix the issue rather easily, and this may also fix the import of some other .doc files which cause hangs ...

Thank you very much!
Comment 5 Cédric Bosdonnat 2014-01-20 08:57:31 UTC
Restricted my LibreOffice hacking area
Comment 6 Joel Madero 2015-05-02 15:42:17 UTC Comment hidden (obsolete)
Comment 7 libreoffice 2015-05-03 08:53:09 UTC
The bug is still present in LibreOffice on Windows x86.
Comment 8 QA Administrators 2016-09-20 10:32:24 UTC Comment hidden (obsolete)
Comment 9 libreoffice 2016-09-20 13:24:54 UTC
Still hangs in LibreOffice windows x86 on Windows 10 1607.
Comment 10 QA Administrators 2018-09-18 02:49:40 UTC Comment hidden (obsolete)
Comment 11 raal 2020-02-18 09:29:19 UTC
The bug is still present in Version: (x64), OS windows
Comment 12 Justin L 2020-04-17 14:01:28 UTC
Created attachment 159660 [details]
Microsoft Word - libo_hang_sec2011_502RT2003.pdf: just for an idea of what is inside.

repro 7.0+
Comment 13 libreoffice 2020-11-07 16:57:16 UTC
Apparently the checkbox in the document is positioned in a way that makes the line with the checkbox 1 twip larger than the line width, which seems to result in an underflow loop in the layout code.

This might be a result of SwFieldFormCheckboxPortion::Format always returning false, while other Format methods seem to return true if the portion doesn't fit.

I've changed the return false statement in SwFieldFormCheckboxPortion::Format to
return rInf.X() + Width() > rInf.Width()
and that seems to work, the document opens without hanging.
Comment 14 QA Administrators 2022-11-08 03:48:22 UTC Comment hidden (obsolete)
Comment 15 libreoffice 2022-11-08 10:45:55 UTC
Still hangs.
Version: / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 4; OS: Linux 5.11; UI render: default; VCL: qt5 (qfont+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: CL