[mksh/f14/master] - fix crash when bad substitution is used

Michal Hlavinka mhlavink at fedoraproject.org
Wed Jan 5 11:41:46 UTC 2011


commit 6bd0c7d242b69e8d171cfd0b4e5ac09eacf7f198
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Wed Jan 5 12:41:35 2011 +0100

    - fix crash when bad substitution is used

 mksh-39c-fixsusbst.patch |   47 ++++++++++++++++++++++++++++++++++++++++++++++
 mksh.spec                |    9 +++++++-
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/mksh-39c-fixsusbst.patch b/mksh-39c-fixsusbst.patch
new file mode 100644
index 0000000..4e74886
--- /dev/null
+++ b/mksh-39c-fixsusbst.patch
@@ -0,0 +1,47 @@
+diff -up mksh-39c/check.t.fixsubst mksh-39c/check.t
+--- mksh-39c/check.t.fixsubst	2011-01-04 15:55:30.493395051 +0100
++++ mksh-39c/check.t	2011-01-04 15:57:48.681133798 +0100
+@@ -4452,6 +4452,22 @@ expected-stderr-pattern:
+ 	/bad substitution/
+ expected-exit: 1
+ ---
++name: xxx-variable-syntax-2
++stdin:
++	set 0
++	echo ${*:0}
++expected-stderr-pattern:
++	/bad substitution/
++expected-exit: 1
++---
++name: xxx-variable-syntax-3
++stdin:
++	set -A foo 0
++	echo ${foo[*]:0}
++expected-stderr-pattern:
++	/bad substitution/
++expected-exit: 1
++---
+ name: xxx-substitution-eval-order
+ description:
+ 	Check order of evaluation of expressions
+diff -up mksh-39c/eval.c.fixsubst mksh-39c/eval.c
+--- mksh-39c/eval.c.fixsubst	2010-02-25 21:18:39.000000000 +0100
++++ mksh-39c/eval.c	2011-01-04 15:55:30.500394934 +0100
+@@ -1016,6 +1016,8 @@ varsub(Expand *xp, const char *sp, const
+ 		case '=':	/* can't assign to a vector */
+ 		case '%':	/* can't trim a vector (yet) */
+ 		case '#':
++		case '0':
++		case '/':
+ 			return (-1);
+ 		}
+ 		if (e->loc->argc == 0) {
+@@ -1039,6 +1041,8 @@ varsub(Expand *xp, const char *sp, const
+ 			case '%':	/* can't trim a vector (yet) */
+ 			case '#':
+ 			case '?':
++			case '0':
++			case '/':
+ 				return (-1);
+ 			}
+ 			XPinit(wv, 32);
diff --git a/mksh.spec b/mksh.spec
index 1d865b2..11c1318 100644
--- a/mksh.spec
+++ b/mksh.spec
@@ -3,7 +3,7 @@
 Summary:          MirBSD enhanced version of the Korn Shell
 Name:             mksh
 Version:          39c
-Release:          3%{?dist}
+Release:          4%{?dist}
 # BSD (setmode.c), ISC (strlcpy.c), MirOS (the rest)
 License:          MirOS and ISC and BSD
 Group:            System Environment/Shells
@@ -12,6 +12,7 @@ Source0:          http://www.mirbsd.org/MirOS/dist/mir/%{name}/%{name}-R%{versio
 Source1:          dot-mkshrc
 Patch1:           mksh-39c-fixsetx.patch
 Patch2:           mksh-39c-dblalias.patch
+Patch3:           mksh-39c-fixsusbst.patch
 Requires(post):   grep
 Requires(postun): sed
 BuildRequires:    util-linux, ed
@@ -37,6 +38,9 @@ mv %{name}/* . && rm -rf %{name}
 # from upstream cvs, for mksh < "R39 2010/07/21", rhbz#616777
 %patch2 -p1 -b .dblalias
 
+# from upstream cvs, for mksh < "R39 2010/05/17", rhbz#618274
+%patch3 -p1 -b .fixsubst
+
 %build
 CFLAGS="$RPM_OPT_FLAGS" sh Build.sh -r -combine
 
@@ -78,6 +82,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/%{name}.1*
 
 %changelog
+* Wed Jan 05 2011 Michal Hlavinka <mhlavink at redhat.com> 39c-4
+- fix crash when bad substitution is used
+
 * Wed Jul 21 2010 Michal Hlavinka <mhlavink at redhat.com> 39c-3
 - fix crash when alias contains alias
 - fix crash when xtrace is enabled


More information about the scm-commits mailing list