summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-17 15:35:04 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-17 15:35:04 +0000
commit0570626cc583fd5897f4a16c3a03e45e1d639f37 (patch)
treec9c5f1b91f6138639b2704989ab875b4a971a6d1 /regex.c
parent08d683deb24cae10ac5e2b8328b082573ef171ac (diff)
preview2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index 651cc36a42..9268b31f9b 100644
--- a/regex.c
+++ b/regex.c
@@ -1438,6 +1438,10 @@ re_compile_pattern(pattern, size, bufp)
EXTEND_BUFFER;
}
range_retry:
+ if (range && had_char_class) {
+ FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as a end value of range");
+ goto invalid_pattern;
+ }
PATFETCH(c);
if (c == ']') {
@@ -1473,6 +1477,7 @@ re_compile_pattern(pattern, size, bufp)
if (current_mbctype) {
set_list_bits(0x80, 0xffffffff, b);
}
+ had_char_class = 1;
last = -1;
continue;
@@ -1483,6 +1488,7 @@ re_compile_pattern(pattern, size, bufp)
!current_mbctype && SYNTAX(c) != Sword2))
SET_LIST_BIT(c);
}
+ had_char_class = 1;
last = -1;
continue;
@@ -1490,6 +1496,7 @@ re_compile_pattern(pattern, size, bufp)
for (c = 0; c < 256; c++)
if (ISSPACE(c))
SET_LIST_BIT(c);
+ had_char_class = 1;
last = -1;
continue;
@@ -1499,12 +1506,14 @@ re_compile_pattern(pattern, size, bufp)
SET_LIST_BIT(c);
if (current_mbctype)
set_list_bits(0x80, 0xffffffff, b);
+ had_char_class = 1;
last = -1;
continue;
case 'd':
for (c = '0'; c <= '9'; c++)
SET_LIST_BIT(c);
+ had_char_class = 1;
last = -1;
continue;
@@ -1514,6 +1523,7 @@ re_compile_pattern(pattern, size, bufp)
SET_LIST_BIT(c);
if (current_mbctype)
set_list_bits(0x80, 0xffffffff, b);
+ had_char_class = 1;
last = -1;
continue;