Bug 8961

Summary: Bash Compatible sub string of variable when evaluating negative value causes seg fault
Product: Busybox Reporter: Mike Frysinger <vapier>
Component: OtherAssignee: unassigned
Status: RESOLVED DUPLICATE    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.24.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Mike Frysinger 2016-05-26 16:20:23 UTC
When referencing a sub-string of a variable, using a negative value stored
in another variable, the shell will seg-fault.

Steps to reproduce:
/ # s=abcdefg
/ # n=2
/ # echo ${s:$n}
cdefg
/ # n=-2
/ # echo ${s:$n}
Segmentation fault

Expected behavior:
/ # s=abcdefg
/ # n=2
/ # echo ${s:$n}
cdefg
/ # n=-2
/ # echo ${s:$n}
fg
Comment 1 Mike Frysinger 2016-05-26 16:20:32 UTC

*** This bug has been marked as a duplicate of bug 7688 ***