[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
segfault expanding certain arrays created via read -N directly to an arr
From: |
Dan Douglas |
Subject: |
segfault expanding certain arrays created via read -N directly to an array. |
Date: |
Mon, 19 Dec 2011 10:12:38 -0600 |
User-agent: |
KMail/4.7.3 (Linux/3.1.5-pf; KDE/4.7.3; x86_64; ; ) |
Hi, This seems to corrupt the array in a way that crashes when trying to expand
the array. Also occurs with the previous patchset.
~ $ ( while read -rn 1 'x[y++]'; do :; done < <(printf '%s\n' {0..5}); declare
-p x; echo "address@hidden" )
declare -a x='([0]="0" [1]="" [2]="1" [3]="" [4]="2" [5]="" [6]="3" [7]=""
[8]="4" [9]="" [10]="5" [11]="" [12]="")'
0 1 2 3 4 5
~ $ ( while read -rN 1 'x[y++]'; do :; done < <(printf '%s\n' {0..5}); declare
-p x; echo "address@hidden" )
declare -a x='([0]="0" [1]= [2]="1" [3]= [4]="2" [5]= [6]="3" [7]= [8]="4" [9]=
[10]="5" [11]= [12]="")'
Segmentation fault
gcc: 4.6.2
CHOST: x86_64-pc-linux-gnu
flags: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu'
-DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc'
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I.
-I. -I./include -I./lib
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
-DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin'
-DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout'
-DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -march=native -O2 -ggdb -pipe
uname -a: Linux ormaajbox 3.1.5-pf #47 SMP PREEMPT Mon Dec 12 15:58:12 CST 2011
x86_64 Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz GenuineIntel GNU/Linux
Bash version: 4.2-p20
(gdb) set args -c 'while read -rN 1 '\''x[y++]'\''; do :; done < <(printf
'\''%s\n'\'' {0..5}); declare -p x; echo "address@hidden"'
Thread 1 (process 24471):
#0 make_bare_word (string=0x0) at make_cmd.c:99
temp = <optimized out>
#1 0x0000000000457d91 in array_to_word_list (a=0x6f6720) at array.c:722
list = <optimized out>
ae = 0x6f6810
#2 0x0000000000459df4 in array_value_internal (s=0x6f6280 "address@hidden",
quoted=1, flags=<optimized out>, rtype=0x7fffffffca58,
indp=<optimized out>) at arrayfunc.c:913
len = 2
ind = <optimized out>
akey = <optimized out>
retval = <optimized out>
t = 0x6f6282 "@]"
temp = <optimized out>
l = <optimized out>
var = <optimized out>
#3 0x00000000004503df in parameter_brace_expand_word (name=0x6f6280
"address@hidden", var_is_special=0, quoted=1, pflags=2, indp=0x7fffffffcb28)
at subst.c:5676
ret = 0x0
temp = 0x0
tt = <optimized out>
arg_index = <optimized out>
var = <optimized out>
atype = <optimized out>
rflags = 0
ind = <optimized out>
#4 0x000000000044b041 in parameter_brace_expand (string=0x6f63f0
"address@hidden", indexp=0x7fffffffcc04, quoted=1, pflags=0,
quoted_dollar_atp=0x7fffffffcd00, contains_dollar_at=0x7fffffffcd08) at
subst.c:7161
check_nullness = 0
var_is_set = 0
var_is_null = 0
var_is_special = 0
want_substring = 0
want_patsub = 0
want_casemod = 0
name = 0x6f6280 "address@hidden"
value = 0x0
temp = 0x0
temp1 = <optimized out>
tdesc = <optimized out>
ret = 0x0
t_index = 6
sindex = 7
c = 125
tflag = 0
modspec = 32767
number = <optimized out>
ind = -9223372036854775808
#5 0x000000000044d72d in param_expand (string=0x6f63f0 "address@hidden",
sindex=0x7fffffffccfc, quoted=1,
expanded_something=<optimized out>, contains_dollar_at=<optimized out>,
quoted_dollar_at_p=0x7fffffffcd00,
had_quoted_null_p=0x7fffffffcd04, pflags=0) at subst.c:7630
temp = 0x0
temp1 = <optimized out>
uerror = "\005\000"
zindex = 1
t_index = <optimized out>
expok = <optimized out>
c = <optimized out>
number = <optimized out>
var = <optimized out>
list = <optimized out>
tdesc = 0x0
ret = 0x0
tflag = 0
#6 0x000000000044e5ae in expand_word_internal (word=0x6f62c0, quoted=1,
isexp=0, contains_dollar_at=0x7fffffffcdf8,
expanded_something=0x0) at subst.c:8118
list = <optimized out>
tword = <optimized out>
istring = 0x6f5c70 ""
istring_size = 112
istring_index = 0
temp = <optimized out>
temp1 = <optimized out>
string = 0x6f63f0 "address@hidden"
string_size = 7
sindex = 0
quoted_dollar_at = 0
quoted_state = 0
had_quoted_null = 0
has_dollar_at = 0
tflag = <optimized out>
pflags = <optimized out>
assignoff = -1
c = 36 '$'
t_index = 7
twochars = <optimized out>
state = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}
#7 0x000000000044f402 in expand_word_internal (word=0x6f6260, quoted=0,
isexp=0, contains_dollar_at=0x7fffffffce7c,
expanded_something=0x7fffffffce78) at subst.c:8255
list = <optimized out>
tword = 0x6f62c0
istring = 0x6f61c0 ""
istring_size = 112
istring_index = 0
temp = 0x0
temp1 = <optimized out>
string = 0x6f66a0 "\"address@hidden""
string_size = 9
sindex = 9
quoted_dollar_at = 0
quoted_state = 2
had_quoted_null = 0
has_dollar_at = 0
tflag = <optimized out>
pflags = <optimized out>
assignoff = -1
c = <optimized out>
t_index = 1
twochars = <optimized out>
state = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}
#8 0x0000000000450788 in shell_expand_word_list (tlist=0x6f6330,
eflags=<optimized out>) at subst.c:9215
temp_list = <optimized out>
expanded_something = 0
has_dollar_at = 0
expanded = <optimized out>
new_list = <optimized out>
next = 0x0
temp_string = <optimized out>
#9 expand_word_list_internal (list=<optimized out>, eflags=31) at subst.c:9332
new_list = 0x6f63b0
temp_list = <optimized out>
tint = <optimized out>
#10 0x0000000000431239 in execute_simple_command (fds_to_close=<optimized out>,
async=0, pipe_out=-1, pipe_in=-1,
simple_command=0x6f5860) at execute_cmd.c:3771
words = <optimized out>
lastword = <optimized out>
command_line = 0x0
temp = <optimized out>
builtin_is_special = 0
already_forked = 0
func = <optimized out>
first_word_quoted = 0
result = 0
dofork = <optimized out>
builtin = <optimized out>
old_builtin = <optimized out>
old_command_builtin = <optimized out>
lastarg = <optimized out>
old_last_async_pid = 24474
#11 execute_command_internal (command=0x6f5830, asynchronous=<optimized out>,
pipe_in=-1, pipe_out=<optimized out>,
fds_to_close=<optimized out>) at execute_cmd.c:735
exec_result = 0
user_subshell = <optimized out>
invert = <optimized out>
ignore_return = 0
was_error_trap = 0
my_undo_list = 0x0
exec_undo_list = 0x0
last_pid = -1
save_line_number = 0
#12 0x0000000000434893 in execute_connection (command=0x6f58f0, asynchronous=0,
pipe_in=-1, pipe_out=-1, fds_to_close=0x6f5920)
at execute_cmd.c:2328
tc = <optimized out>
second = <optimized out>
ignore_return = 0
exec_result = <optimized out>
was_error_trap = <optimized out>
invert = <optimized out>
save_line_number = <optimized out>
#13 0x0000000000430486 in execute_command_internal (command=0x6f58f0,
asynchronous=<optimized out>, pipe_in=-1, pipe_out=-1,
fds_to_close=0x6f5920) at execute_cmd.c:891
exec_result = 0
user_subshell = <optimized out>
invert = 0
ignore_return = 0
was_error_trap = <optimized out>
my_undo_list = 0x0
exec_undo_list = 0x0
last_pid = <optimized out>
save_line_number = <optimized out>
#14 0x000000000046d7b3 in parse_and_execute (string=<optimized out>,
from_file=<optimized out>, flags=<optimized out>)
at evalstring.c:319
bitmap = 0x6f5920
code = 0
lreset = <optimized out>
should_jump_to_top_level = 0
last_result = 0
command = 0x6f58f0
#15 0x000000000041d399 in run_one_command (command=<optimized out>) at
shell.c:1315
code = 0
#16 0x000000000041c2c6 in main (argc=3, argv=0x7fffffffd448,
env=0x7fffffffd468) at shell.c:688
i = <optimized out>
code = <optimized out>
old_errexit_flag = 0
saverst = 0
locally_skip_execution = 0
arg_index = 3
top_level_arg_index = 3
--
Dan Douglas
signature.asc
Description: This is a digitally signed message part.
- segfault expanding certain arrays created via read -N directly to an array.,
Dan Douglas <=