Bug 143028 - FILESAVE DOCX Export of "bracePair" produces invalid file, that Word cannot read
Summary: FILESAVE DOCX Export of "bracePair" produces invalid file, that Word cannot read
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha0+
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Attila Bakos (NISZ)
URL:
Whiteboard: target:7.3.0 target:7.2.0.0.beta2
Keywords: implementationError
Depends on:
Blocks: Shape-ODF-OOXML-export
  Show dependency treegraph
 
Reported: 2021-06-23 21:04 UTC by Regina Henschel
Modified: 2021-07-02 09:03 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
file to reproduce the invalid docx document (9.17 KB, application/vnd.oasis.opendocument.text)
2021-06-23 21:04 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2021-06-23 21:04:17 UTC
Created attachment 173123 [details]
file to reproduce the invalid docx document

Open attached file and export it to docx. Open the exported file in Word. Word cannot read it. Reason is a duplicate <a:xfrm> element.

Some investigation:
DMLPresetShapeExporter::WriteShapeWithAVlist() calls WriteShapeTransformation which writes the first <a:xfrm> element.
Then it calls GetAdjustmentPointXValue(0)

DMLPresetShapeExporter::GetAdjustmentPointXValue() calls GetHandleValueOfModificationPoint(nPoint, u"RangeXMinimum")

That has a loop over all Name/Value pairs. In case of "bracePair" the loop will find nothing, because they do not have "RangeXMinimum" but "RangeYMinimum". Thus the return value is empty.

Back in GetHandleValueOfModificationPoint it makes a .get() on the empty return value, which gives a runtime error. That is caught in WriteShapeWithAVlist and makes it return 'false'.

With this 'false' the part after shapes.cxx#848 is entered. And that will write in #873 the <a:xfrm> element again.
Comment 1 Regina Henschel 2021-06-23 21:32:18 UTC
bracketPair fails too.
Comment 2 NISZ LibreOffice Team 2021-06-24 07:01:54 UTC
I think this is expected for now. 
Proper handling of these shapes is asked in bug 142603 and the initial implementation of the new export class has just not covered those cases. 

Neither the rest of shapes in bug 142599 bug 142601 bug 142602 bug 142604 - but eventually we shall get there.
Comment 3 Attila Bakos (NISZ) 2021-06-24 08:27:35 UTC
Thank you for reporting the bug. Unfortunately, i can reproduce this, however the fix coming soon (test and merge left).

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 90df123cd9ff9fc1c7b991d9ae9a1ed8c9e9f0de
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL
Comment 4 Commit Notification 2021-07-01 11:51:47 UTC
Attila Bakos (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/99a459dfdfd9f82ed3506708e131dd52a1a62384

tdf#143028 DOCX: fix corrupt export of shape "bracePair" etc.

It will be available in 7.3.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 5 Commit Notification 2021-07-01 15:13:17 UTC
Attila Bakos (NISZ) committed a patch related to this issue.
It has been pushed to "master":

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

tdf#143028 DOCX export: fix RangeY regression of preset shapes

It will be available in 7.3.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 6 Commit Notification 2021-07-02 09:03:56 UTC
Attila Bakos (NISZ) committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

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

tdf#143028 DOCX: fix corrupt export of shape "bracePair" etc.

It will be available in 7.2.0.0.beta2.

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.