Bug 55502 - Shell BASIC function with invalid Pathname command causes hang with bSync=true and bSync=false
Summary: Shell BASIC function with invalid Pathname command causes hang with bSync=tru...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Linux (All)
: high major
Assignee: Julien Nabet
URL:
Whiteboard: target:5.0.0 target:4.4.4
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-01 15:38 UTC by Viktor Mileikovskyi
Modified: 2015-04-20 12:14 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
The file has two macroses. See Attachment full description: (10.59 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-10-01 15:38 UTC, Viktor Mileikovskyi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Viktor Mileikovskyi 2012-10-01 15:38:36 UTC
Created attachment 67931 [details]
The file has two macroses. See Attachment full description:

Calling Shell causes hang if Pathname not found.

Steps to reproduce (assumed that a command sp8bnrf2kx9s is invalid):
1. Download TestShell.ods
2. SAVE ALL DOCUMENTS IN LIBREOFFICE! Possible hanging!
3. Open TestShell.ods. Allow macros.
4. Press one of two buttons

Current behaviour
    Hang. Only kill helps
Expected behaviour
    Rising error 53: File not found.

Operating system:
    Ubuntu 12.04 x86-64

Attachment full description:
    The file has two macroses associated with two buttons:
Sub TestWait 'Associated with "TEST SHELL WITH WAITING"
    shell("sp8bnrf2kx9s",6,"",True)
End Sub
Sub TestNoWait 'Associated with "TEST SHELL WITHOUT WAITING"
    shell("sp8bnrf2kx9s",6,"",False)
End Sub
Comment 1 Buovjaga 2014-11-06 12:35:51 UTC
On 4.3.3. I get "File not found" and crash.

On 4.4 I get:

Assertion failed!
Program: ...gram Files (x86)\LibreOfficeDev 4\program\sblo.dll File : C:\cygwin\home\tinderbox\master\include\rtl/ustring.hxx Line: 421

Expression: index >= 0 &&static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())

Win 7 64-bit 4.3.3.2 and Version: 4.4.0.0.alpha1+
Build ID: 8b21b5cbe78945b27525b4ce78ae3d981f90590f
TinderBox: Win-x86@39, Branch:master, Time: 2014-11-06_03:55:51
Comment 2 Joel Madero 2015-01-06 19:25:37 UTC
Just a follow-up.

Confirmed on:
Ubuntu 14.04
LibreOffice 3.3 (inherited from OOo).

Are we 100% sure that this isn't an enhancement request?

Anyways, Updating version to reflect that I've confirmed on the oldest version (and thus not a regression).

Also:
Lowering priority.

Major - hang but not going to affect the majority of users (probably going to affect a tiny fraction of users). Critical is reserved for crashes/hangs that will affect a large number of users.

High - default is fine here.
Comment 3 Julien Nabet 2015-04-18 20:46:48 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

Part of bt:
#2  0x00002aaaab2b5226 in __assert_fail_base (fmt=0x2aaaab3ebce8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x2aaaae2ecf10 "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())", 
    file=file@entry=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=line@entry=500, 
    function=function@entry=0x2aaaae2ed740 <rtl::OUString::operator[](int) const::__PRETTY_FUNCTION__> "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:92
#3  0x00002aaaab2b52d2 in __GI___assert_fail (assertion=0x2aaaae2ecf10 "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())", 
    file=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=500, 
    function=0x2aaaae2ed740 <rtl::OUString::operator[](int) const::__PRETTY_FUNCTION__> "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:101
#4  0x00002aaaae1f44f8 in rtl::OUString::operator[] (this=0x7fffffff36b0, index=13) at /home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx:500
#5  0x00002aaaae274036 in SbRtl_Shell (pBasic=0x3531fc0, rPar=..., bWrite=false) at /home/julien/compile-libreoffice/libreoffice/basic/source/runtime/methods.cxx:3613
#6  0x00002aaaae264be2 in SbiStdObject::Notify (this=0x3532380, rBC=..., rHint=...) at /home/julien/compile-libreoffice/libreoffice/basic/source/runtime/stdobj.cxx:848
Comment 4 Commit Notification 2015-04-18 21:44:04 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=41392516ca0fc099c383c4319923b895ecc16be6

tdf#55502: Shell BASIC function with empty third param hangs

It will be available in 5.0.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.
Comment 5 Julien Nabet 2015-04-18 21:56:23 UTC
For 4.4, there's a patch on gerrit:
https://gerrit.libreoffice.org/#/c/15380/

I'd prefer waiting for the validation of this patch before putting this one to WFM.
Indeed, even if with the patch, it doesn't crash, perhaps it's not right way to fix this.
Comment 6 Commit Notification 2015-04-19 13:47:18 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a75d90740647414f55ef5a37bdfb230d624ec2eb

Related tdf#55502: Harden a bit

It will be available in 5.0.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.
Comment 7 Commit Notification 2015-04-20 10:27:57 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ec485dc13bd16a3a9c168758cd742fe38e78b482&h=libreoffice-4-4

tdf#55502: Shell BASIC function with empty third param hangs

It will be available in 4.4.4.

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.