Bug 140572 - FILESAVE DOCX Crash when saving a file with superscript formatting
Summary: FILESAVE DOCX Crash when saving a file with superscript formatting
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha0+
Hardware: Other All
: high critical
Assignee: Justin L
URL:
Whiteboard: target:7.2.0 target:7.1.2 target:7.0.5
Keywords: bibisected, bisected, filter:docx, haveBacktrace, regression
Depends on:
Blocks: DOCX-Character
  Show dependency treegraph
 
Reported: 2021-02-21 00:17 UTC by Will
Modified: 2021-02-26 15:27 UTC (History)
5 users (show)

See Also:
Crash report or crash signature: ["MSWordExportBase::GetItem(unsigned short)"]


Attachments
screenshot of the message displayed after it crashes (53.26 KB, image/jpeg)
2021-02-21 00:21 UTC, Will
Details
another screenshot after it crashes (41.79 KB, image/jpeg)
2021-02-21 00:25 UTC, Will
Details
another screenshot after it crashes (65.15 KB, image/jpeg)
2021-02-21 00:25 UTC, Will
Details
The document that I was trying to save when writer crashed. (111.93 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-02-22 02:07 UTC, Will
Details
bt with debug symbols (12.42 KB, text/plain)
2021-02-22 21:41 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Will 2021-02-21 00:17:11 UTC
Description:
Every time I try to remove the spaces from this document and resave it, Libreoffice crashes. I have no idea why. Please help.

Steps to Reproduce:
1. remove the spaces from the document
2. save it
3.writer libreoffice crashes

Actual Results:
remove spaces. it crashes after saving.

Expected Results:
crashed


Reproducible: Always


User Profile Reset: Yes



Additional Info:
not crashed
Comment 1 Will 2021-02-21 00:21:44 UTC
Created attachment 169934 [details]
screenshot of the message displayed after it crashes
Comment 2 Will 2021-02-21 00:25:22 UTC
Created attachment 169935 [details]
another screenshot after it crashes
Comment 3 Will 2021-02-21 00:25:42 UTC
Created attachment 169936 [details]
another screenshot after it crashes
Comment 4 Will 2021-02-21 00:27:23 UTC
the same thing was happening with the 2nd newest release of libreoffice. I downloaded and installed the newer version because I thought it might solve the problem. It didn't. Please let me know how to fix this issue
Comment 5 Julien Nabet 2021-02-21 08:25:01 UTC
Without the doc Word or at minimum the crash report, there's nothing that can be done.
Comment 6 Will 2021-02-22 02:03:59 UTC
(In reply to Julien Nabet from comment #5)
> Without the doc Word or at minimum the crash report, there's nothing that
> can be done.

it says the crash report was sent to the document foundation
Comment 7 Will 2021-02-22 02:04:37 UTC
(In reply to Will from comment #6)
> (In reply to Julien Nabet from comment #5)
> > Without the doc Word or at minimum the crash report, there's nothing that
> > can be done.
> 
> it says the crash report was sent to the document foundation

I will upload the document
Comment 8 Will 2021-02-22 02:07:30 UTC
Created attachment 169953 [details]
The document that I was trying to save when writer crashed.
Comment 9 QA Administrators 2021-02-22 04:00:59 UTC Comment hidden (obsolete)
Comment 10 Aleksandar Kondic 2021-02-22 05:59:02 UTC
Hi Will,

I was able to replicate this issue in: 

Version: 7.1.0.3 / LibreOffice Community
Build ID: f6099ecf3d29644b5008cc8f48f42f4a40986e4c
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 11 Julien Nabet 2021-02-22 21:41:43 UTC
Created attachment 169974 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I got an assertion.

Just remove 1 space and try to save in docx
Comment 12 Buovjaga 2021-02-23 11:07:35 UTC
Bibisected with linux-64-6.4 to
https://git.libreoffice.org/core/commit/d71cf6390a89ea6a4fab724e3a7996f28ca33661
tdf#99602 writerfilter: import subscript into character style and superscripts (aka escapements, but who knows that term).

The document certainly has a ton of superscript formatting.

Adding Cc: to Justin Luth
Comment 13 Justin L 2021-02-23 12:17:07 UTC
My patch is an import patch, so it seems to be exposing a problem on the export side. That said, I don't see everything in Word being considered to be in superscript.  I wonder why not, since:
<w:docDefaults>
  <w:rPrDefault>
    <w:rPr>
      <w:position w:val="18"/>
...
    </w:rPr>
  </w:rPrDefault>
</w:docDefaults>

Are they making some kind of exception in this case?  (There are a few other character properties here, so this is not a unique entry...)
Comment 14 Justin L 2021-02-23 14:40:19 UTC
Proposed fix at https://gerrit.libreoffice.org/c/core/+/111403
Comment 15 Buovjaga 2021-02-23 16:42:06 UTC
(In reply to Justin L from comment #14)
> Proposed fix at https://gerrit.libreoffice.org/c/core/+/111403

Thanks, I built and verified the fix.
Comment 16 Justin L 2021-02-24 14:14:55 UTC
There are two nearly identical methods HasItem and GetItem. GetItem assumes that it MUST be available. See bug 112169 for a similar situation (although I think that one also had numbering as a trigger point as well as docDefaults).

A more generic fix is probably to set m_pISet to something like mrExport.m_rDoc.GetAttrPool() in DocxAttributeOutput::DocDefaults.
Comment 17 Commit Notification 2021-02-24 18:54:05 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/76d2a9fd461dde817fbb1c5d4aa830cb2c42b504

tdf#140572 docx export: avoid DocDefault superscript crash

It will be available in 7.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 18 Will 2021-02-25 02:02:11 UTC
Thank you all for your help! much appreciated.
Comment 19 Commit Notification 2021-02-25 09:12:56 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/2f26a9c9242b8443f0fb987822404027053a98ff

tdf#140572 docx export: avoid DocDefault superscript crash

It will be available in 7.0.6.

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 20 Commit Notification 2021-02-25 09:45:23 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/2465b0467d57ca325e820f13efeb40e69386b4a1

tdf#140572 docx export: avoid DocDefault superscript crash

It will be available in 7.1.2.

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 21 Justin L 2021-02-25 09:51:21 UTC
(In reply to Justin L from comment #13)
> I don't see everything in Word being considered to be in superscript.

Not marking as fixed yet since there is a patch in the queue to avoid making everything superscript.  https://gerrit.libreoffice.org/c/core/+/111442
Comment 22 Commit Notification 2021-02-25 09:57:40 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/861ca1f5030f2f6b7fbdc3bb3ded3d11130673ed

tdf#140572 writerfilter: ignore position in docDefaults

It will be available in 7.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 23 Commit Notification 2021-02-25 11:35:29 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-0-5":

https://git.libreoffice.org/core/commit/24ad70e40191c3f04ab96fc97e6cd80706ee7e31

tdf#140572 docx export: avoid DocDefault superscript crash

It will be available in 7.0.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 24 Commit Notification 2021-02-26 12:26:08 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/633e72f078f99eb9f27e4ff623111ab634ff6fe1

tdf#140572 writerfilter: ignore position in docDefaults

It will be available in 7.1.2.

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.