commit bash-20170505 snapshot

This commit is contained in:
Chet Ramey
2017-05-08 10:53:50 -04:00
parent 2a39157723
commit af2a77fbbc
14 changed files with 125 additions and 30 deletions
+15 -6
View File
@@ -283,8 +283,13 @@ popexp ()
{
EXPR_CONTEXT *context;
if (expr_depth == 0)
evalerror (_("recursion stack underflow"));
if (expr_depth <= 0)
{
/* See the comment at the top of evalexp() for an explanation of why
this is done. */
expression = lasttp = 0;
evalerror (_("recursion stack underflow"));
}
context = expr_stack[--expr_depth];
@@ -307,7 +312,8 @@ expr_unwind ()
free (expr_stack[expr_depth]);
}
free (expr_stack[expr_depth]); /* free the allocated EXPR_CONTEXT */
if (expr_depth == 0)
free (expr_stack[expr_depth]); /* free the allocated EXPR_CONTEXT */
noeval = 0; /* XXX */
}
@@ -397,6 +403,9 @@ evalexp (expr, flags, validp)
expr_unwind ();
/* We copy in case we've called evalexp recursively */
FASTCOPY (oevalbuf, evalbuf, sizeof (evalbuf));
if (validp)
*validp = 0;
return (0);
@@ -1456,11 +1465,11 @@ evalerror (msg)
char *name, *t;
name = this_command_name;
for (t = expression; whitespace (*t); t++)
for (t = expression; t && whitespace (*t); t++)
;
internal_error (_("%s%s%s: %s (error token is \"%s\")"),
name ? name : "", name ? ": " : "", t,
msg, (lasttp && *lasttp) ? lasttp : "");
name ? name : "", name ? ": " : "",
t ? t : "", msg, (lasttp && *lasttp) ? lasttp : "");
sh_longjmp (evalbuf, 1);
}