Bug 160779

Summary: Fileopen XLSX: protectedRange without name and sqref is invalid
Product: LibreOffice Reporter: Timur <timur>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: NEEDINFO ---    
Severity: normal CC: aron.budea, stephane.guillou
Priority: medium Keywords: filter:xlsx
Version: 24.8.0.0 alpha0+   
Hardware: All   
OS: All   
URL: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_protectedRange_topic_ID0ERYC5.html
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=134920
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104839    
Attachments: Sample XLSX with short-hand protectedRange

Description Timur 2024-04-22 11:28:55 UTC
Created attachment 193800 [details]
Sample XLSX with short-hand protectedRange

protectedRange of XLSX is not supported in LO and that is bug 134920.
XLSX files should be kept proper, though and they normally are.
There is a possibility of short-hand version of range address in file (sqref="10:131" instead of sqref="A10:XFD131"), that is read by MSO. 
Sample is attached.
LO opens it but saves wrongly. There is https://gerrit.libreoffice.org/c/core/+/166269 for that. 

This ticket is about applying the OOXML Standard that says that child attributes name and sqref of protectedRange are required. 
Without it, MSO says that XLSX is corrupted, and LO should also do it.
That would safeguard XLSX in saving, so that potential wrong save is seen on next fileopen.
Comment 1 Stéphane Guillou (stragu) 2024-05-23 07:01:47 UTC
I resaved attachment 193800 [details] with:

Version: 24.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 101b08fe1ec77ffe8c1a9b2b8f9f20884269a1ed
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Reload in LO shows no warning, but opening it in MS 365 neither.

I see that a29d91ac403f1ed431ca95b8b9c290bd354c3ae7 and cfb913db1b2024f8ff6a55f45742b303107a1924 are both merged already.
Am I missing something? Do you have updated steps to illustrate how the file gets corrupted?

Relevant part of OOXML spec[1]:
<complexType name="CT_ProtectedRange">
	<attribute name="password" type="ST_UnsignedShortHex" use="optional"/>
	<attribute name="sqref" type="ST_Sqref" use="required"/>
	<attribute name="name" type="ST_Xstring" use="required"/>
	<attribute name="securityDescriptor" type="xsd:string" use="optional"/>
</complexType>

[1]: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_protectedRange_topic_ID0ERYC5.html