Hi,

we found a bug in ksh. It uses only short size int for curenv (current subshell number) and once it overflows, it crashes.

Reproducer:
===============================================
#!/bin/ksh

main()
{

 typeset i=0;
 typeset b="";

  (while true
  do
    (b=$(printf %08d ${i}));
    (( i = ${i} + 1 ))
     echo $i;
  done)
  echo "count : ${i}";
}

main "$@";
===============================================

./test.sh
...
...
32765
32766
32767
Segmentation fault

Tested with ksh 2012-08-01. Let me know if you need more information.

Michal
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to