Bug 161139 - FILEOPEN DOCX SaxException when opening specific file
Summary: FILEOPEN DOCX SaxException when opening specific file
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.3 release
Hardware: All All
: high major
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0 target:24.8.1 target:24...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-SAXParse Regressions-ooxml-handle-first-hdr-ftr
  Show dependency treegraph
 
Reported: 2024-05-16 18:59 UTC by Gabor Kelemen (allotropia)
Modified: 2024-08-20 17:02 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of the issue (9.84 KB, image/png)
2024-05-16 18:59 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2024-05-16 18:59:10 UTC
Created attachment 194157 [details]
Screenshot of the issue

1. Open attachment 180759 [details] from bug 149563
2. SaxException

Since:

https://git.libreoffice.org/core/+/4b0fa253a4540f5461397815d290586f9ddabe61

author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	Tue Nov 28 13:46:21 2023 +0900
committer	Tomaž Vajngerl <quikee@gmail.com>	Fri Dec 01 08:26:38 2023 +0100

tdf#136472 adjust ooxml import to handle first header/footer
Comment 1 Gabor Kelemen (allotropia) 2024-05-16 19:00:09 UTC
Adding CC to: Tomaž Vajngerl
Comment 2 Aron Budea 2024-05-16 19:13:10 UTC
Confirmed using LO 24.8.0.0.alpha0+ (6d5d9eaa61505cebaf3bde4bfc157d8e19fec8de) / Ubuntu.
Comment 3 Justin L 2024-07-10 20:42:58 UTC
Lovely: it occurs when calling DomainMapper_Impl::ConvertHeaderFooterToTextFrame
Comment 4 Justin L 2024-07-11 19:24:55 UTC
The problem seems to be coming from copyHeaderFooter().
Converted1 does not have bHasHeader, so it gets turned on with
    xStyle->setPropertyValue(sHeaderIsOn, uno::Any(bPreviousHasHeader ...

The act of turning on the header triggers a Notify of SwXHeadFootText::Impl::Notify that m_pHeadFootFormat "First footer" is "Dying"

because ChgPageDesc did a SwDoc::CopyMasterFooter.
So my guess is that the xTextAppend is connected to an orphaned footer, but my brain is not large enough to understand all this stuff.

We could easily put a try/catch inside ConvertHeaderFooterToTextFrame's while loop, but that would simply be an avoidance "fix".
Comment 5 Justin L 2024-08-19 15:20:54 UTC
avoided in 25.2 with commit cf22d66c5837f108296b37bc98f17ee96869a7ef
Author: Miklos Vajnaon Tue Aug 6 08:30:22 2024 +0200
    Related: tdf#162295 DOCX import: optimize copying headers/footers

backporting to 24.8 is easy/automatic. to 24.2 will be slightly harder since Noel moved writerfilter into SW in April 2024.
Comment 6 Xisco Faulí 2024-08-19 17:18:52 UTC
(In reply to Justin L from comment #5)
> avoided in 25.2 with commit cf22d66c5837f108296b37bc98f17ee96869a7ef
> Author: Miklos Vajnaon Tue Aug 6 08:30:22 2024 +0200
>     Related: tdf#162295 DOCX import: optimize copying headers/footers
> 
> backporting to 24.8 is easy/automatic. to 24.2 will be slightly harder since
> Noel moved writerfilter into SW in April 2024.

Done in https://gerrit.libreoffice.org/c/core/+/171990
Comment 7 Commit Notification 2024-08-19 20:41:07 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#161139: add unit test to sw filters pass

It will be available in 25.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 8 Commit Notification 2024-08-20 10:25:32 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

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

tdf#161139: add unit test to sw filters pass

It will be available in 24.8.1.

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 9 Commit Notification 2024-08-20 17:02:56 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/9a288db65a6c5d665edd4067093a076c9507603c

tdf#161139: add unit test to sw filters pass

It will be available in 24.2.7.

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.