[Libreoffice-bugs] [Bug 57113] Macros: Unicode vs. password protected user libraries
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Tue Sep 17 12:11:05 UTC 2019
https://bugs.documentfoundation.org/show_bug.cgi?id=57113
--- Comment #16 from Mike Kaganski <mikekaganski at hotmail.com> ---
The problem happens at file save stage. The strings are written to the binary
image (Module1.bin) in SfxScriptLibraryContainer::implStorePasswordLibrary; it
calls SbModule::StoreBinaryData, which in turn calls SbiImage::Save.
The strings are 1-byte-encoded: the encoding used is initially taken from
current thread text encoding (on Windows, that's always system encoding); the
loaded module might change the encoding (see SbiImage::Load); and *both
SbiImage::Load and SbiImage::Save* filter the possible encoding to only be
1-byte encoding (using resp. GetSOLoadTextEncoding and GetSOStoreTextEncoding).
It means, for instance, that UTF-8 is impossible for the encoding of strings
here.
If current system encoding happens to support the characters in the module,
then the resulting image would contain the properly encoded characters (e.g.,
when I open protected document from attachment 70101 on my Russian Windows,
open the module entering the password, and then save the document), the image
has the correct Cyrillic characters (and correct encoding number), so then the
resulting file may be used without the password later. But I suppose that the
test file was created on a system with non-Cyrillic thread encoding.
I don't know if it's possible to change the format to accept UTF-8 as encoding.
Hope that the analysis would help.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190917/48c8abe0/attachment.html>
More information about the Libreoffice-bugs
mailing list