Download it now!
Bug 70627 - LibreOffice-Writer freezes entering a complicated search string in find&replace dialogue
Summary: LibreOffice-Writer freezes entering a complicated search string in find&repla...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.1.2 release
Hardware: x86 (IA32) Linux (All)
: medium critical
Assignee: Eike Rathke
URL:
Whiteboard: target:4.3.0 target:4.2.0.0.beta2 tar...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-18 18:41 UTC by wettererscheinung
Modified: 2013-11-26 08:44 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wettererscheinung 2013-10-18 18:41:32 UTC
Whenever I enter the following searchstring in the find&replace dialogue in a document actually containing text which would be found by this string LibreOffice Writer hangs up / crashes.

\{05(>|)(1|2|3|4|)\}([:alpha:]|[:space:]|_|\[|\]|\\|:|\?|\{(/|)0(1|2|4|6)(>|)(1|2|3|4|5|6|7|)(>|)(1|2|3|direkt|spaeter|passiv|)(>|)(1|2|eng|lose|)(: |)([:alpha:]|[:space:]|_|)+\}|.)+\{/05(>|)(1|2|3|4|)(: |)([:alpha:]|[:space:]|_|)+\}

This is reproducable in any documents which contain matches. Like the following:

{01>1}{02>1>2}{06>6}Nam liber{06>3} tempor cum soluta nobis eleifend{/06>3} option congue nihil imperdiet doming id quod mazim placerat facer possim assum.{04>3} Lorem ipsum dolor sit a{/06>6}met, consectetuer adipiscing elit,{05>1} sed diam nonummy nibh{/04>3} euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex{/05>1: Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis} ea commodo consequat.  {/02>1>2} {/01>1}
Comment 1 Eike Rathke 2013-10-18 20:33:13 UTC
Not a crash but a freeze (endless loop) in ICU's RegexMatcher::MatchChunkAt()
Comment 2 Eike Rathke 2013-10-18 20:47:44 UTC
Reported upstream as https://ssl.icu-project.org/trac/ticket/10496
Comment 3 Eike Rathke 2013-11-25 16:02:11 UTC
Seem they won't and we can't change anything.
https://ssl.icu-project.org/trac/ticket/10496#comment:3
Comment 4 Eike Rathke 2013-11-25 16:25:48 UTC
Adding some sort of "time limit" as described in https://ssl.icu-project.org/apiref/icu4c/uregex_8h.html#a7b42432bc279a11c8a5e2c83f767181d may help.
Comment 5 Eike Rathke 2013-11-25 16:41:41 UTC
Or better https://ssl.icu-project.org/apiref/icu4c/classicu_1_1RegexMatcher.html#a6ebcfcab4fe6a38678c0291643a03a00 since we use an instance of RegexMatcher.
Comment 6 Eike Rathke 2013-11-25 16:53:29 UTC
I'll give that a try.
Comment 7 Commit Notification 2013-11-25 23:23:00 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d838ea200e7d6060d4a759616f9e1fcbf3c36c8e

set a 23 enigma timeout at RegexMatcher, fdo#70627



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2013-11-25 23:25:21 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=12ebbb7e471d851eec940a47e6737c7c89d0f7f8&h=libreoffice-4-2

set a 23 enigma timeout at RegexMatcher, fdo#70627


It will be available in LibreOffice 4.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Eike Rathke 2013-11-25 23:27:53 UTC
Pending review for 4-1 as https://gerrit.libreoffice.org/6808
Comment 10 Eike Rathke 2013-11-25 23:32:12 UTC
Note that this solution sets a timeout that, depending on processor speed, breaks the exponential run time after ~30-50 seconds returning "not found" even if theoretically there could be a match. For such rare patterns this appears to be a better solution than freezing the application for hours or days..
Comment 11 Commit Notification 2013-11-26 08:44:46 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b103d14aaac3d96f7b60ce1baa9c581a102a1e63&h=libreoffice-4-1

set a 23 enigma timeout at RegexMatcher, fdo#70627


It will be available in LibreOffice 4.1.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.