Bug 142405 - Binary image for encrypted library is incompatible with anything older than 5.0.3, regardless of image size
Summary: Binary image for encrypted library is incompatible with anything older than 5...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.0.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectNotNeeded, difficultyMedium, easyHack, regression, skillCpp
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2021-05-21 08:29 UTC by Mike Kaganski
Modified: 2021-07-08 03:46 UTC (History)
1 user (show)

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


Attachments
Password for library is "1234" (12.31 KB, application/vnd.oasis.opendocument.text)
2021-05-21 08:29 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
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