Bug 151912 - crash of LibreOffice Writer with files .docx
Summary: crash of LibreOffice Writer with files .docx
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.4.1.2 release
Hardware: All All
: medium normal
Assignee: Vasily Melenchuk (CIB)
URL:
Whiteboard: target:7.5.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Opening
  Show dependency treegraph
 
Reported: 2022-11-04 21:04 UTC by Chollot
Modified: 2023-01-26 12:50 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
this file is a recipe page (19.31 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-11-04 21:08 UTC, Chollot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chollot 2022-11-04 21:04:44 UTC
Description:
LibreOffice reports an error when i open a file microsoft word .docx 
Most of my .docx which hve been done in LibreOfficeV3 are no more anymore visible with the LibreOffice version 4 
The error message is : 
Une erreur s'est produite pendant l'ouverture du fichier. Cela peut provenir d'un contenu du fichier incorrect.
Les détails de l'erreur sont :
SAXException: [word/document.xml line 2]: unknown error
Faire l'importation peut provoquer une perte ou une corruption de donnée, et l'application peut devenir instable ou cesser de fonctionner.

Voulez-vous ignorer l'erreur et tenter de continuer à charger le fichier ? OUI/NON

or , other message is:
Erreur de format de fichier à la position 
SAXParseException: '[word/document.xml line 2]: unknown error', Stream 'word/document.xml', Line 2, Column 10674(row,col).


When i select OUI , Writer opens an empty document 



Steps to Reproduce:
1.double click on the attached file coquilles Stxxxx.docx
2.error message appears. Select Yes
3.

Actual Results:
Une erreur s'est produite pendant l'ouverture du fichier. Cela peut provenir d'un contenu du fichier incorrect.
Les détails de l'erreur sont :
SAXException: [word/document.xml line 2]: unknown error
Faire l'importation peut provoquer une perte ou une corruption de donnée, et l'application peut devenir instable ou cesser de fonctionner.

Voulez-vous ignorer l'erreur et tenter de continuer à charger le fichier ?

Expected Results:
the document should appears


Reproducible: Always


User Profile Reset: Yes

Additional Info:
the document is opened like an empty file
Comment 1 Chollot 2022-11-04 21:08:18 UTC
Created attachment 183422 [details]
this file is a recipe page
Comment 2 m_a_riosv 2022-11-05 02:10:10 UTC
Reproducible:
Version: 7.5.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 643fec7cf7a81bf8c89a8efd47c0310b38f9076c
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL threaded Jumbo
And
Version: 7.3.7.2 (x64) / LibreOffice Community
Build ID: e114eadc50a9ff8d8c8a0567d6da8f454beeb84f
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: es-ES Calc: CL

Last I have opening fine:
Version: 7.2.7.2 (x64) / LibreOffice Community
Build ID: 8d71d29d553c0f7dcbfa38fbfda25ee34cce99a2
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: es-ES Calc: CL
Comment 3 raal 2022-11-06 21:05:28 UTC
This seems to have begun at the below commit.
Adding Cc: to Vasily Melenchuk ; Could you possibly take a look at this one?
Thanks
 e894e8559875e32657ffbdd2015c6471c7973942 is the first bad commit
commit e894e8559875e32657ffbdd2015c6471c7973942
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Tue Dec 21 23:48:49 2021 +0100

    source a4432eb0946c0bc775b3d30b634bef5d66544f8d

https://git.libreoffice.org/core/+/a4432eb0946c0bc775b3d30b634bef5d66544f8d
Comment 4 Vasily Melenchuk (CIB) 2022-11-08 08:14:01 UTC
Problem is reproduced and reason is found: evaluation of SDT elements did fail because all SDT elements have xpath query with namespaces (for example /ns0:BlogPostInfo/ns0:PostTitle for first field). But no definition for what is ns0 was provided in doc. Interesting, that MS Word seems ignores this issue and still evals expath.
Comment 5 Commit Notification 2022-11-14 08:21:28 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

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

tdf#151912: sw: suppress exceptions during SDT evluation

It will be available in 7.5.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 Vasily Melenchuk (CIB) 2022-11-14 08:26:09 UTC
Partial fix to this problem is done: error in fetching of value of SDT field should not cancel document loading. It is not a critical error and for MS Word just a placeholder text is displayed.

But meanwhile given document is okay with MS Word ad data should be loaded. Seems MS Word is working with external XML and XPath namespaces in a different way: there is XPath with namespaces in SDT in given doc, but no namespaces are given. Thus LO fails to do XPath (since my recent patch this is no longer a critical problem). But which namespace should be used? Topic to investigate.

So bug is not closed in spite of original document is looking okay.
Comment 7 Gabor Kelemen (allotropia) 2023-01-26 12:50:57 UTC
Verified in

Version: 7.5.0.0.alpha1 (X86_64) / LibreOffice Community
Build ID: 2b4d136b65bc79a1248876160e85fab79d52d5d6
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded

Document load does not cause a crash anymore.
Saved version looks kinda the same in Word as the original.