bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bash-4.0.10: segfault with `; &' at the end of case statement


From: Clark J. Wang
Subject: [PATCH] bash-4.0.10: segfault with `; &' at the end of case statement
Date: Sat, 14 Mar 2009 14:00:35 +0800

With bash version: 4.0.10, the following case statement crashed with
segfault:

$ cat foo.sh
case a in
    a) echo a ;&
esac
$ bash4 foo.sh
a
Segmentation fault
$

In an interactive shell, that case statement causes current shell to hang
with nearly 100% CPU usage.

The following patch fixes this for me:

*** ../bash-4.0/execute_cmd.c   2009-02-14 05:41:41.000000000 +0800
--- execute_cmd.c       2009-03-14 13:47:15.000000000 +0800
***************
*** 2930,2936 ****
                  retval = execute_command (clauses->action);
                }
              while ((clauses->flags & CASEPAT_FALLTHROUGH) && (clauses =
clauses->next));
!             if ((clauses->flags & CASEPAT_TESTNEXT) == 0)
                EXIT_CASE ();
              else
                break;
--- 2930,2936 ----
                  retval = execute_command (clauses->action);
                }
              while ((clauses->flags & CASEPAT_FALLTHROUGH) && (clauses =
clauses->next));
!             if (!clauses || (clauses->flags & CASEPAT_TESTNEXT) == 0)
                EXIT_CASE ();
              else
                break;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]