Michal Hlavinka from Red Hat found another SIGSEGV

fix: when iterating over all Sources, know when to stop…
This commit is contained in:
tg 2010-07-21 11:31:16 +00:00
parent c6eedad976
commit c11d35312a
3 changed files with 17 additions and 6 deletions

15
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.383 2010/07/19 22:41:01 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.384 2010/07/21 11:31:13 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -25,7 +25,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R39 2010/07/19
@(#)MIRBSD KSH R39 2010/07/21
description:
Check version of shell.
stdin:
@ -185,6 +185,17 @@ expected-stdout:
tf
tf
---
name: alias-10
description:
Check that recursion is detected/avoided in aliases.
Regression, introduced during an old bugfix.
stdin:
alias foo='print hello '
alias bar='foo world'
echo $(bar)
expected-stdout:
hello world
---
name: arith-lazy-1
description:
Check that only one side of ternary operator is evaluated

4
lex.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.116 2010/07/17 22:09:36 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.117 2010/07/21 11:31:15 tg Exp $");
/*
* states while lexing word
@ -1110,7 +1110,7 @@ yylex(int cf)
else {
Source *s = source;
while (s->flags & SF_HASALIAS)
while (s && (s->flags & SF_HASALIAS))
if (s->u.tblp == p)
return (LWORD);
else

4
sh.h
View File

@ -150,9 +150,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.399 2010/07/19 22:41:03 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.400 2010/07/21 11:31:16 tg Exp $");
#endif
#define MKSH_VERSION "R39 2010/07/19"
#define MKSH_VERSION "R39 2010/07/21"
#ifndef MKSH_INCLUDES_ONLY