Pretty straightforward, really - the following sub crashes LibreOffice on my system (3.6.0.4, Windows 8). Sometimes it runs once and catches the error, and the second run crashes: Sub crashMe on error goto noExist shell("doesnotexist") exit Sub noExist: msgbox("caught error") End Sub I see this related post on the OOo site: http://user.services.openoffice.org/en/forum/viewtopic.php?f=45&t=54752 (pertains to LO 3.5.4 on Linux; same exact symptoms)
Reproducible with: LibreOffice 3.5.4.2 Build ID: 350m1(Build:2) and Version 3.7.0.0.alpha0+ (Build ID: 784302d)
I can reproduce this, and I am working on fixing it.
To reproduce the bug in existing code: 1. Click Tools > Macros > Organize Macros > LibreOffice BASIC; 2. On the left pane ("Macro From Field"), Navigate to My Macros > Standard > Module1 (or wherever you want to test); 3. On the right pane ("Existing Macros In"), select "main"; 4. Click the "Edit" button; 5. Paste in the following code: Sub crashMe on error goto noExist shell("doesnotexist") exit Sub noExist: msgbox("caught error") End Sub 6. Press F5; 7. Observe that LO crashes. After my change: 1. Click Tools > Macros > Organize Macros > LibreOffice BASIC; 2. On the left pane ("Macro From Field"), Navigate to My Macros > Standard > Module1 (or wherever you want to test); 3. On the right pane ("Existing Macros In"), select "main"; 4. Click the "Edit" button; 5. Paste in the following code: Sub crashMe on error goto noExist shell("doesnotexist") exit Sub noExist: msgbox("caught error") End Sub 6. Press F5; 7. Observe that the message box contains the following: BASIC runtime error. File not found. However, ensure that LO does not crash. You can also verify that using shell to execute an existing program still works. For example, instead of executing "doesnotexist," you might try "notepad" (for Windows) or "gedit" (for many versions of Linux). What I am changing: I am checking bSucc to make sure that osl_executeProcess was successful. If bSucc is false, there is no need to free the handle. The problem is that the process handle is freed regardless of whether osl_executeProcess was successful or not. Therefore, a segmentation fault would result, as a random memory address would be freed. This patch checks whether osl_executeProcess was successful. If it was, then it frees the handle; if it wasn't successful, the memory is not freed.
Christopher Copits committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=dbfc8777bf73872d1b96f956b9e778d9099d52b3 fdo#53521 Crash when running BASIC's "shell()" with a non-existent program The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Christopher Copits committed a patch related to this issue. It has been pushed to "libreoffice-4-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=96b985145b3efbaf4552adbeccf24bfac2fa71b0&h=libreoffice-4-0 fdo#53521 Crash when running BASIC's "shell()" with a non-existent program It will be available in LibreOffice 4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Christopher Copits committed a patch related to this issue. It has been pushed to "libreoffice-3-6": http://cgit.freedesktop.org/libreoffice/core/commit/?id=ccd30d3bb395fd367d8b687fc2b3b13641c8d846&h=libreoffice-3-6 fdo#53521 Crash when running BASIC's "shell()" with a non-existent program It will be available in LibreOffice 3.6.5. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
this bug should be fixed now on all active release branches, thanks Christopher Copits for the patch!