Discussion:
[ast-developers] ksh crash in sfclose() due to double free()
Siteshwar Vashisht
2017-01-04 12:16:42 UTC
Permalink
Hello,

There is a bug in sh_eval() function that may cause ksh to crash due to double free() after sourcing multiple files. I am providing a patch to fix this bug.
cat functions.ksh
#!/bin/ksh

function f1
{
echo "f1"
}

function f2
{
if [[ $1 -eq 1 ]]: then
echo "f2"
fi
}

function f3
{

[[ 1 = 1 ]] && set -x

}
cat sub1.ksh
#!/bin/ksh

. ./functions.ksh

echo "sub1" > ./tmp.out
cat main.ksh
#!/bin/ksh
. ./sub1.ksh
ksh main.ksh
main.ksh[2]: .[3]: .: syntax error at line 10: `]]:' unexpected
Segmentation fault (core dumped)
--
--
Siteshwar Vashisht
Loading...