Fix patterns crashes.

ok jasper@
This commit is contained in:
pea 2011-01-17 16:19:43 +00:00
parent 656aca2600
commit 5f7121fba2
3 changed files with 47 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.58 2010/12/27 14:04:31 pea Exp $
# $OpenBSD: Makefile,v 1.59 2011/01/17 16:19:43 pea Exp $
COMMENT= Z shell, Bourne shell-compatible
@ -6,6 +6,8 @@ V= 4.3.11
DISTNAME= zsh-$V
CATEGORIES= shells
REVISION= 0
MAINTAINER= Pierre-Emmanuel Andre <pea@openbsd.org>
HOMEPAGE= http://www.zsh.org/

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-Src_text_c,v 1.1 2011/01/17 16:19:43 pea Exp $
Fix patterns crashes: http://www.zsh.org/mla/workers/2011/msg00027.html
--- Src/text.c.orig Tue Sep 14 16:46:26 2010
+++ Src/text.c Mon Jan 17 16:58:41 2011
@@ -785,8 +785,7 @@ gettext2(Estate state)
taddstr(" ");
taddstr(ecgetstr(state, EC_NODUP, NULL));
if (ctype == COND_STREQ ||
- ctype == COND_STRNEQ ||
- ctype == COND_REGEX)
+ ctype == COND_STRNEQ)
state->pc++;
} else {
/* Unary test: `-f foo' etc. */

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-Test_C02cond_ztst,v 1.1 2011/01/17 16:19:43 pea Exp $
Fix patterns crashes: http://www.zsh.org/mla/workers/2011/msg00027.html
--- Test/C02cond.ztst.orig Mon Oct 11 10:35:39 2010
+++ Test/C02cond.ztst Mon Jan 17 16:58:41 2011
@@ -306,6 +306,21 @@ F:Failures in these cases do not indicate a problem in
2:Error message for unknown infix condition
?(eval):1: unknown condition: -fail
+ crashme() {
+ if [[ $1 =~ ^http:* ]]
+ then
+ url=${1#*=}
+ fi
+ }
+ which crashme
+0:Regression test for examining code with regular expression match
+>crashme () {
+> if [[ $1 =~ ^http:* ]]
+> then
+> url=${1#*=}
+> fi
+>}
+
%clean
# This works around a bug in rm -f in some versions of Cygwin
chmod 644 unmodish