Bug 142405

Summary: Binary image for encrypted library is incompatible with anything older than 5.0.3, regardless of image size
Product: LibreOffice Reporter: Mike Kaganski <mikekaganski>
Component: BASICAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: mentoring
Priority: medium Keywords: bibisectNotNeeded, difficultyMedium, easyHack, regression, skillCpp
Version: 5.0.3.2 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=142391
https://bugs.documentfoundation.org/show_bug.cgi?id=92620
https://bugs.documentfoundation.org/show_bug.cgi?id=94617
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 107659    
Attachments: Password for library is "1234"

Description Mike Kaganski 2021-05-21 08:29:06 UTC
Created attachment 172222 [details]
Password for library is "1234"

Since fixing bug 94617, the binary images generated by LibreOffice use new incompatible format of storing method data unconditionally (see SbMethod::StoreData changed in [1]), even when writing legacy image formats, and not only for image format 0x13 (see basic/source/inc/filefmt.hxx). This makes the encrypted library unusable in any older LO version, as well as in OOo and AOO.

Steps to reproduce:
1. Create a new document;
2. Add a library to it (in Basic IDE use Tools->Select Module, and on Libraries tab, under current document location, use New button);
3. Password-protect it;
4. Add a short method to it (e.g., simply calling MsgBox with a short message);
5. Add a button calling the method;
6. Save the document
7. Try pressing the button in any AOO version (or in LO 5.0.2 or older).

At step 6, there's no compatibility warning. At step 7, there will be an error message telling that the Basic script is not found (unlike the newer LO versions).

The code writing the new format should be made conditional on which image format is being written. The code pointer is in the commit [1].

[1] https://git.libreoffice.org/core/+/ddb45261590939d884ac2bcb1fd258de7b2370da
Comment 1 Mike Kaganski 2021-05-21 10:18:40 UTC
Another code pointer: note that currently, SbModule::StoreBinaryData just calls SbiImage::Save with the default value of version, unlike in the past, where it used to check compatibility (see e.g. [1]).

[1] https://git.libreoffice.org/core/+/f3f67b770b90c81de82bc38a26e794ad72956c1a/basic/source/classes/sbxmod.cxx#1790
Comment 2 Andreas Heinisch 2021-07-07 18:10:51 UTC
Confirmed in:

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 0aea0cee58fe77a9058217dfdfc3d6a02b29ee2a
CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-US
Calc: CL
Comment 3 Andreas Heinisch 2023-03-23 15:37:00 UTC

*** This bug has been marked as a duplicate of bug 142391 ***