Re: Segfault assigning to nameref with bad array subscript

2016-05-01 Thread Chet Ramey
On 4/27/16 2:45 AM, Grisha Levit wrote: > Any of the following will crash bash: > > declare -n ref=a[*]; ref= > declare -n ref=a[@]; ref= > declare -n ref=a[-1]; a=(); ref= > > declare -A A; declare -n ref='A[$unset]'; ref= > > They all produce "bad array subscript" errors so could be caught. T

Re: Segfault assigning to nameref with bad array subscript

2016-04-27 Thread Piotr Grzybowski
Hi Grisha, confirmed. I think this one fixes it: diff --git a/variables.c b/variables.c index 69ed170..9eeda46 100644 --- a/variables.c +++ b/variables.c @@ -2636,9 +2636,14 @@ bind_variable_internal (name, value, table, hflags, aflags) #if defined (ARRAY_VARS) /* declare -n foo=x[2] *

Segfault assigning to nameref with bad array subscript

2016-04-26 Thread Grisha Levit
Any of the following will crash bash: declare -n ref=a[*]; ref= declare -n ref=a[@]; ref= declare -n ref=a[-1]; a=(); ref= declare -A A; declare -n ref='A[$unset]'; ref= They all produce "bad array subscript" errors so could be caught. ==60597== Invalid read of size 4 ==60597==at 0x100020BE