Bug 89710 - Runtime error executing function in huge password protected Basic macro library
Summary: Runtime error executing function in huge password protected Basic macro library
Status: RESOLVED DUPLICATE of bug 94617
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 87530
Blocks:
  Show dependency treegraph
 
Reported: 2015-02-27 09:09 UTC by Gerhard Schaber
Modified: 2016-03-07 12:56 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Dialog showing the error (4.14 KB, image/png)
2015-02-27 09:09 UTC, Gerhard Schaber
Details
File to reproduce the issue (12.28 KB, application/vnd.sun.xml.base)
2015-02-27 11:05 UTC, Gerhard Schaber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Schaber 2015-02-27 09:09:11 UTC
Created attachment 113731 [details]
Dialog showing the error

When executing a sub in a 3000 line password protected Basic library, that accesses a global variable, it get a runtime error. I cannot share the actual file, but I am trying to create a separate one that shows the issues. so far without luck.

Note that the library must be password protected with OpenOffice, since LibreOffice still has the bug #87530.

The stack trace looks like this:
wow64win.dll+0x3acaa
wow64win.dll+0x16434
wow64.dll!Wow64SystemServiceEx+0xd7
wow64cpu.dll!TurboDispatchJumpAddressEnd+0xb
wow64.dll!Wow64SystemServiceEx+0x26a
wow64.dll!Wow64LdrpInitialize+0x435
ntdll.dll!LdrGetKnownDllSectionHandle+0x1b5
ntdll.dll!WinSqmCheckEscalationSetDWORD+0x11739
ntdll.dll!LdrInitializeThunk+0xe
USER32.dll!gapfnScSendMessage+0x305
vcllo.dll!?OpenTTFontBuffer@vcl@@YAHPBXKKPAPAU_TrueTypeFont@1@@Z+0x17206
vcllo.dll!?OpenTTFontBuffer@vcl@@YAHPBXKKPAPAU_TrueTypeFont@1@@Z+0x17a53
vcllo.dll!?ImplCallEventListeners@Application@@SAXPAVVclSimpleEvent@@@Z+0x152
vcllo.dll!?Yield@Application@@SAXXZ+0x9
svtlo.dll!?GetString@SfxErrorContext@@UAE_NKAAVOUString@rtl@@@Z+0x709
KERNELBASE.dll!GetProcAddressForCaller+0x58
sfxlo.dll!??_8SfxAbstractDialogFactory@@7B@+0x24
sfxlo.dll!?GlobalBasicErrorHdl_Impl@SfxApplication@@AAEJPAVStarBASIC@@@Z+0x66
sfxlo.dll!?LinkStubGlobalBasicErrorHdl_Impl@SfxApplication@@CAJPAX0@Z+0xe
tllo.dll!?Call@Link@@QBEJPAX@Z+0x11
sblo.dll!?RTError@StarBASIC@@AAE_NKABVOUString@rtl@@JJJ@Z+0x203
sblo.dll!?Y@Point@@QAEAAJXZ+0xc87a
sblo.dll!?SetVBAEnabled@StarBASIC@@QAEX_N@Z+0x90e
sblo.dll!?RunInit@SbModule@@IAEXXZ+0xb8
sblo.dll!?InitAllModules@StarBASIC@@QAEXPAV1@@Z+0x20a
sblo.dll!?GlobalRunInit@SbModule@@IAEX_N@Z+0x4f
sblo.dll!?Run@SbModule@@IAEGPAVSbMethod@@@Z+0x310
sblo.dll!?Notify@SbModule@@MAEXAAVSfxBroadcaster@@ABVSfxHint@@@Z+0x455
sblo.dll!?Broadcast@SbMethod@@UAEXK@Z+0x148
sblo.dll!?Get@SbxValue@@UBE_NAAUSbxValues@@@Z+0x8e
sblo.dll!?Call@SbMethod@@UAEKPAVSbxValue@@PAVSbxVariable@@@Z+0x86
sfxlo.dll!?getTypes@?$WeakImplHelper2@VXStatusListener@frame@star@sun@com@@VXComponent@lang@345@@cppu@@UAA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@XZ+0x1fc
sfxlo.dll!?CallXScript@SfxObjectShell@@SAKABV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@ABV?$Sequence@VAny@uno@star@sun@com@@@3456@AAVAny@3456@AAV?$Sequence@F@3456@AAV93456@_NPBVAny@3456@@Z+0x2f1
sfxlo.dll!?OfaExec_Impl@SfxApplication@@QAEXAAVSfxRequest@@@Z+0x90c
sfxlo.dll!?Type@SfxApplication@@UBEP6APAXXZXZ+0x42e
sfxlo.dll!?Call_Impl@SfxDispatcher@@AAEHAAVSfxShell@@ABVSfxSlot@@AAVSfxRequest@@_N@Z+0x24d
sfxlo.dll!?_Execute@SfxDispatcher@@IAEXAAVSfxShell@@ABVSfxSlot@@AAVSfxRequest@@W4SfxCallMode@@@Z+0x6b
sfxlo.dll!?Execute@SfxDispatcher@@QAEPBVSfxPoolItem@@GW4SfxCallMode@@PAVSfxItemSet@@1G@Z+0x1cb
sfxlo.dll!?updateItems@ThumbnailView@@QAEXABV?$vector@PAVThumbnailViewItem@@V?$allocator@PAVThumbnailViewItem@@@std@@@std@@@Z+0x6f03
sfxlo.dll!?updateItems@ThumbnailView@@QAEXABV?$vector@PAVThumbnailViewItem@@V?$allocator@PAVThumbnailViewItem@@@std@@@std@@@Z+0x722d
vcllo.dll!?ImplCallEventListeners@Menu@@IAEXKG@Z+0xbb
tllo.dll!?Call@Link@@QBEJPAX@Z+0x11
vcllo.dll!?Select@Menu@@UAEXXZ+0x8b
vcllo.dll!?LinkStubImplCallSelect@Menu@@KAJPAX0@Z+0x12
tllo.dll!?Call@Link@@QBEJPAX@Z+0x11
vcllo.dll!?ImplAsyncFocusHdl@Window@vcl@@QAEJPAX@Z+0x3452
vcllo.dll!?ImplAsyncFocusHdl@Window@vcl@@QAEJPAX@Z+0x3cc4
vcllo.dll!?OpenTTFontBuffer@vcl@@YAHPBXKKPAPAU_TrueTypeFont@1@@Z+0x47a69
vcllo.dll!?OpenTTFontBuffer@vcl@@YAHPBXKKPAPAU_TrueTypeFont@1@@Z+0x4a34b
vcllo.dll!?OpenTTFontBuffer@vcl@@YAHPBXKKPAPAU_TrueTypeFont@1@@Z+0x4a940
USER32.dll!CallNextHookEx+0x1c5
USER32.dll!WaitMessage+0x11b
USER32.dll!RegisterWindowMessageW+0xa6c
USER32.dll!DispatchMessageW+0x10
vcllo.dll!?OpenTTFontBuffer@vcl@@YAHPBXKKPAPAU_TrueTypeFont@1@@Z+0x171c4
vcllo.dll!?OpenTTFontBuffer@vcl@@YAHPBXKKPAPAU_TrueTypeFont@1@@Z+0x17a53
vcllo.dll!?Execute@Application@@SAXXZ+0x69
vcllo.dll!?DeInitVCL@@YAXXZ+0x634
soffice.bin+0x101e
soffice.bin!main+0x27f
ntdll.dll!RtlInitializeExceptionChain+0x85
ntdll.dll!RtlInitializeExceptionChain+0x58
Comment 1 Gerhard Schaber 2015-02-27 09:10:26 UTC
When I specify the password prior to the macro execution, there is no error.
Comment 2 Gerhard Schaber 2015-02-27 09:18:57 UTC
The code is pretty simple. At the beginning of the macro library module, there is:
Global datecheck As Integer

And in some sub that I run, it says:
sub foo()
if (datecheck = 0) then
datecheck = 1
endif
end sub

It somehow depends on the size of the module. Adding just long REM lines does not help to reproduce this, it must be real code. It is not relevant where the sub is in the module, only how large the whole module is.
Comment 3 Gerhard Schaber 2015-02-27 09:20:16 UTC
OpenOffice has the same issue, by the way. The issue is at least 5 years old.
Comment 4 Gerhard Schaber 2015-02-27 11:05:49 UTC
Created attachment 113744 [details]
File to reproduce the issue
Comment 5 Gerhard Schaber 2015-02-27 11:06:44 UTC
The password for the attached file is testtest32. Open the file and run macro foo2.
Comment 6 raal 2015-02-27 13:53:15 UTC
Hello,
is it this bug?
https://bz.apache.org/ooo/show_bug.cgi?id=26345
Comment 7 Gerhard Schaber 2015-02-27 14:05:14 UTC
Hello, I do not think so. In my case, everything works nicely as long as I do not password protect the library.

Actually, a long time ago I reported a problem to OpenOffice, where passwort protecting a large library would result in destruction of the library (one could not open the library at all afterwards). I will try to find the bug number for that.

But the actual issue with global variables and the size limit of password protected macro libraries seems to be a different one, but I already saw it 5 years ago.
Comment 9 Gerhard Schaber 2015-02-27 14:14:29 UTC
This might be relevant as well: If I select the whole module and copy it to the clipboard, it gets truncated (in the clipbaord). This is no big deal, since one can export the module directly to a file, but maybe it is related to the reported issue.
Comment 10 raal 2015-02-27 15:20:57 UTC
I can confirm with Version: 4.5.0.0.alpha0+
Build ID: a2fa9e2468aa5c4fd4b610c5d0ebc8959e87a072
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2015-02-23_02:34:05
Comment 11 Gerhard Schaber 2015-04-01 20:55:56 UTC
Splitting the huge module into many smaller modules under 65k characters is a workaround.
Comment 12 Gerhard Schaber 2015-04-01 21:07:09 UTC
It would be good to have at least a kind of indicator when you hit the 65k limit.
Comment 13 Gerhard Schaber 2016-03-07 12:56:53 UTC
Please feel free to close this. #94617 seems to fix this, at least if you enter the password of the macro library in LO 5.0.3 or later and save the file. Although the fix introduces a regression #95959, it fixes the current issue.

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