Michal Hlavinka from Red Hat found another SIGSEGV
fix: when iterating over all Sources, know when to stop…
This commit is contained in:
		
							
								
								
									
										15
									
								
								check.t
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								check.t
									
									
									
									
									
								
							| @@ -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: 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: 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 $ | # $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 | # http://www.research.att.com/~gsf/public/ifs.sh | ||||||
|  |  | ||||||
| expected-stdout: | expected-stdout: | ||||||
| 	@(#)MIRBSD KSH R39 2010/07/19 | 	@(#)MIRBSD KSH R39 2010/07/21 | ||||||
| description: | description: | ||||||
| 	Check version of shell. | 	Check version of shell. | ||||||
| stdin: | stdin: | ||||||
| @@ -185,6 +185,17 @@ expected-stdout: | |||||||
| 	tf | 	tf | ||||||
| 	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 | name: arith-lazy-1 | ||||||
| description: | description: | ||||||
| 	Check that only one side of ternary operator is evaluated | 	Check that only one side of ternary operator is evaluated | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								lex.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								lex.c
									
									
									
									
									
								
							| @@ -22,7 +22,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #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 |  * states while lexing word | ||||||
| @@ -1110,7 +1110,7 @@ yylex(int cf) | |||||||
| 			else { | 			else { | ||||||
| 				Source *s = source; | 				Source *s = source; | ||||||
|  |  | ||||||
| 				while (s->flags & SF_HASALIAS) | 				while (s && (s->flags & SF_HASALIAS)) | ||||||
| 					if (s->u.tblp == p) | 					if (s->u.tblp == p) | ||||||
| 						return (LWORD); | 						return (LWORD); | ||||||
| 					else | 					else | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								sh.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								sh.h
									
									
									
									
									
								
							| @@ -150,9 +150,9 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef EXTERN | #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 | #endif | ||||||
| #define MKSH_VERSION "R39 2010/07/19" | #define MKSH_VERSION "R39 2010/07/21" | ||||||
|  |  | ||||||
| #ifndef MKSH_INCLUDES_ONLY | #ifndef MKSH_INCLUDES_ONLY | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user