Bug 162583 - hash character in module1.XBA file previously interpreted as comment but now crashes LibreOffice at start
Summary: hash character in module1.XBA file previously interpreted as comment but now ...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.8.0.3 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-23 03:57 UTC by andrew.james.heard
Modified: 2024-12-23 00:03 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
screen cap when Writer opened (96.79 KB, image/jpeg)
2024-08-23 03:59 UTC, andrew.james.heard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andrew.james.heard 2024-08-23 03:57:04 UTC
Description:
I had some (simplified below) VBA code in
C:\Users\<user>\AppData\Roaming\LibreOffice\4\user\SafeMode\basic\Standard\Module1.xba

Sub testMsgBox()
	Dim sVar As Integer
	#sVar = MsgBox(&quot;test&quot;)
End Sub

In the version 24.2.2.2 this wasn't causing any issues. I assumed the line beginning with the # character was being ignored/ commented out.

When I installed 24.8.0.3_Win_x86-64.msi today, opening any LibreOffice Writer or Calc file would immediately crash with the VBA editor/ IDE displaying the above line. It appears to be the hash character is no longer interpreted as a comment, if it ever was. After a long period of trial & error, I finally found that replacing the # with &apos; fixed the problem.

Steps to Reproduce:
1.Tools > Macros > Edit > add a subroutine
Sub testMsgBox()
	Dim sVar As Integer
	#sVar = MsgBox(&quot;test&quot;)
End Sub
2. close program & restart
3. observe crash

Actual Results:
crash with VBA stuck on line beginning with hash character

Expected Results:
the program should open without error


Reproducible: Always


User Profile Reset: No

Additional Info:
no other info - make this textbox optional?
Comment 1 andrew.james.heard 2024-08-23 03:59:17 UTC
Created attachment 195975 [details]
screen cap when Writer opened
Comment 2 Buovjaga 2024-11-07 17:56:55 UTC
I wonder, if this could be related to bug 93727.

I tried to reproduce the issue, but I didn't get any crash.

Do you also see the crash with a daily build? https://dev-builds.libreoffice.org/daily/master/current.html

Could you give exact steps to follow on how we should create the macro and where exactly? I first tried in a document and then in My Macros.

But you talk about VBA code, so maybe there is some information missing?

You might also try bibisecting this: https://wiki.documentfoundation.org/QA/Bibisect/Windows

You could make it quicker by trying first in the 24.8 Windows repo

git checkout fdae99a7b9e530a48d2383a6ee696115a1be79ec && instdir/program/soffice

and then test - does it crash? If yes, then:

git checkout HEAD~1 && instdir/program/soffice

and test again - now you are testing the immediately preceding commit. If it doesn't crash here, then the culprit is the change of bug 93727.

Otherwise you have to do the full bibisecting procedure.

Arch Linux 64-bit
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 05dafbdc9d7e6755d67d63e58cec3cc1f9038848
CPU threads: 8; OS: Linux 6.11; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Built on 7 November 2024
Comment 3 andrew.james.heard 2024-11-07 20:27:06 UTC
Wow - that's a lot of research. It'll take me a while to work thru those suggestions, so bear with me.
Comment 4 QA Administrators 2024-11-08 03:15:20 UTC Comment hidden (obsolete)
Comment 5 andrew.james.heard 2024-12-23 00:03:08 UTC
tested in 24.8.4.2 & can no longer reproduce, so updated status