Opened 10 years ago
Closed 5 years ago
#3165 closed Bug (Fixed)
Call() function called with an empty array results in APPCRASH
| Reported by: | Rnde | Owned by: | Jon |
|---|---|---|---|
| Milestone: | 3.3.15.4 | Component: | AutoIt |
| Version: | 3.3.15.3 | Severity: | None |
| Keywords: | Call, Ubound, Array | Cc: |
Description
AutoIt3.exe APPCRASH error upon calling Ubound() via Call():
Local $array[0]
$n = Call("Ubound", $array)
Attachments (0)
Change History (9)
comment:1 by , 10 years ago
| Summary: | Ubound() called with Call() function on 0-sized arrays results in APPCRASH → Call() function called with an empty array results in APPCRASH |
|---|
comment:2 by , 10 years ago
I have tried your suggested method, it always returns 0 regardless the array's size.
Local $array[] = [1,2,3]
$n = Call("UBound", "$array")
comment:3 by , 10 years ago
When I run that I get an error message telling me that $array isn't an array or a map, it's possible that you can't use UBound in Call for some reason.
I'd avoid using Call at all if possible, it's almost never needed, and with this example definitely isn't.
But that's beside the point in this instance as I don't know if there's a bug in Ubound or a bug in using Call with UBound.
comment:4 by , 6 years ago
| Resolution: | → Fixed |
|---|---|
| Status: | new → closed |
Current release/beta versions of AutoIt work as intended.
Local $array = [1,2,3] Local $n = Call(UBound, $array) ConsoleWrite($n & @LF)
correctly shows 3
comment:5 by , 6 years ago
jchd18.... NO! sorry not sorry
It is NOT fixed. Firstly, tho not most importantly, a fix necessitates a change to the current codebase. Where's that here? Unthinkable to umm... think... that imaginary Fixes would count, but, well, i dunno, maybe they do and that's controversial?
However if one is willing to admit a possibility of hastily --
(good gosh, its been 5 -five!- efficking years! I don't think that this excuse will.. errm... excuse anyone involved, now will it?!)
hastily made incorrect, nay, wrong "judjmehnt" (sic), then, well... it could make this mess less bad. it might even, y'know... fix it!... *bu-dum ts-- oh no! dish falls, bounces off the floor, breaks the wall in half!! Quick! Get the FlexTape(c)(r)(tm)! Alternativelyyy~
perhaps a wee bit of common sense will fi-- i mean, suffice to fik... err. well you know! that!! and the dish Call'd be as new! Call'd be fi-- ohsorrie, NOT BROKEN!!!!!!!!!!!!!!!! :> y'know! ;) Alternatively still we could just aVoId UsiNg Call At aLL (c) BrewManNM, circa 5 BCY (Before Current Year)
like, i mean, why wouldn't that work, amirite? or, y fix the codes if you can fix the coders[' crooked wishes]? very useful!*
'niway here's a proper reproducer, tested with v3.3.14.1 and v3.3.15.0 and v3.3.15.3. when array has zero size(only 1D), Call crashes the program, regardless of function it is given. seems simply there's no check in Call for zero-sized 1D array.
if array.dimensions==1 AND array[0]=='CallArray..orWhatsItsNameWhoCares' then ... else ...
-- perhaps could be --
if array.dimensions==1 AND array.size>0 AND array[0]=='Yeah...that...' then ... else ...
Global $array[1]
ConsoleWrite('--- with $array of size 1 ---' & @CRLF)
ConsoleWrite("call(fun1, $array) ---> "&@tab)
$ret=call(fun1, $array)
ConsoleWrite('@err='&@error&', @ext='&@extended&', $ret='&$ret &@CRLF)
ConsoleWrite("call(UBound, $array) ---> "&@tab)
$ret=call(UBound, $array)
ConsoleWrite('@err='&@error&', @ext='&@extended&', $ret='&$ret &@CRLF)
Global $array[0]
ConsoleWrite('--- with $array of size 0 ---' & @CRLF)
ConsoleWrite("call(fun1, $array) ---> "&@tab)
$ret=call(fun1, $array)
ConsoleWrite('@err='&@error&', @ext='&@extended&', $ret='&$ret &@CRLF)
ConsoleWrite("call(UBound, $array) ---> "&@tab)
$ret=call(UBound, $array)
ConsoleWrite('@err='&@error&', @ext='&@extended&', $ret='&$ret &@CRLF)
Func fun1($v)
Return 1
EndFunc
ps.: oh yes, it could be longer xD but sorry anyway.
comment:6 by , 6 years ago
pps.: deer jchd18 (sorry i dont know your spiritual animal, so deer will have to do), if above post-wall in any way sounded ad hominem/personalized, plz know that's complitely unintentional, the issue does after all seem like a very easy-to-miss lil oversight. but, see, the times we're in... or was it weather?.. well, you know, it takes some toll. you're alright, so far as i can tell from lurking, which perhaps is irrelevant, but still. Have a nice day/month/millenia, as well as food, too. it's important! :D
comment:7 by , 6 years ago
| Resolution: | Fixed |
|---|---|
| Status: | closed → reopened |
| Version: | 3.3.14.2 → 3.3.15.3 |
comment:9 by , 5 years ago
| Milestone: | → 3.3.15.4 |
|---|---|
| Owner: | changed from to |
| Resolution: | → Fixed |
| Status: | assigned → closed |
Fixed by revision [12556] in version: 3.3.15.4

You need to put the argument for the UBound inside quotes, otherwise you're not telling the function to use UBound on the array, you're telling the Call function that you're sending it an array of parameters, and because there are no parameters it crashes.
Local $array[0] $n = Call("UBound", "$array")It's a bug that it crashes because of this, but the bug is not what you think it is.
I've corrected the title of the bug report to reflect the actual bug condition.