summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-06-22 17:35:38 +0100
committerPeter Stephenson <pws@zsh.org>2015-06-22 17:35:38 +0100
commit7d588bc158c24d4e60b579d60b76cde55225b01c (patch)
tree8028d2181b6dc5fa6176fc8e2da14a4cbd054418 /Src/Modules
parentea0f612c3ad8fa1b4dea2245ce107e751c8e06d6 (diff)
downloadzsh-7d588bc158c24d4e60b579d60b76cde55225b01c.tar.gz
zsh-7d588bc158c24d4e60b579d60b76cde55225b01c.tar.xz
zsh-7d588bc158c24d4e60b579d60b76cde55225b01c.zip
33566: regex module fix for unmatched parentheses
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/regex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Src/Modules/regex.c b/Src/Modules/regex.c
index 94f523f32..16cc77f30 100644
--- a/Src/Modules/regex.c
+++ b/Src/Modules/regex.c
@@ -155,6 +155,11 @@ zcond_regex_match(char **a, int id)
 			 ++n, ++m, ++bptr, ++eptr)
 		    {
 			char buf[DIGBUFSIZE];
+			if (m->rm_so < 0 || m->rm_eo < 0) {
+			    *bptr = ztrdup("-1");
+			    *eptr = ztrdup("-1");
+			    continue;
+			}
 			ptr = lhstr;
 			leftlen = m->rm_so;
 			offs = 0;