Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159081382
D10315.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D10315.id.diff
View Options
Index: head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in
===================================================================
--- head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in
+++ head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in
@@ -1,9 +1,24 @@
# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
+# Begin FreeBSD
+{ C BADRPT
+{ b { {
+\{ - { {
+\{ bC BADRPT
+{} C BADRPT
+{} b {} {}
+\{\} - {} {}
+\{\} bC BADRPT
+} & } }
+\} & } }
+{abc b {abc {abc
+{abc C BADRPT
+# End FreeBSD
{1 C BADRPT
{1} C BADRPT
-a{b & a{b a{b
+# Begin FreeBSD
+a{b b a{b a{b
+a{b C BADRPT
+# End FreeBSD
a{1}b - ab ab
a\{1\}b b ab ab
a{1,}b - ab ab
@@ -16,9 +31,15 @@
a\{1a bC EBRACE
a{1a} C BADBR
a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
+# Begin FreeBSD
+a{,2} b a{,2} a{,2}
+a{,2} C BADBR
+# End FreeBSD
a\{,2\} bC BADBR
-a{,} - a{,} a{,}
+# Begin FreeBSD
+a{,} b a{,} a{,}
+a{,} C BADBR
+# End FreeBSD
a\{,\} bC BADBR
a{1,x} C BADBR
a\{1,x\} bC BADBR
Index: head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in
===================================================================
--- head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in
+++ head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in
@@ -15,7 +15,10 @@
a{1}* C BADRPT
a{1}+ C BADRPT
a{1}? C BADRPT
-a*{b} - a{b} a{b}
+# Begin FreeBSD
+a*{b} b a{b} a{b}
+a*{b} C BADRPT
+# End FreeBSD
a\{1\}\{1\} bC BADRPT
a*\{1\} bC BADRPT
a\{1\}* bC BADRPT
Index: head/lib/libc/regex/regcomp.c
===================================================================
--- head/lib/libc/regex/regcomp.c
+++ head/lib/libc/regex/regcomp.c
@@ -412,6 +412,7 @@
case '*':
case '+':
case '?':
+ case '{':
SETERROR(REG_BADRPT);
break;
case '.':
@@ -438,9 +439,6 @@
break;
}
break;
- case '{': /* okay as ordinary except if digit follows */
- (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
default:
if (p->error != 0)
return (false);
@@ -454,9 +452,11 @@
return (false);
c = PEEK();
/* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit((uch)PEEK2())) ))
+ if (!( c == '*' || c == '+' || c == '?' || c == '{'))
return (false); /* no repetition, we're done */
+ else if (c == '{')
+ (void)REQUIRE(MORE2() && \
+ (isdigit((uch)PEEK2()) || PEEK2() == ','), REG_BADRPT);
NEXT();
(void)REQUIRE(!wascaret, REG_BADRPT);
@@ -757,7 +757,6 @@
(void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
break;
case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
SETERROR(REG_EPAREN);
break;
case BACKSL|'1':
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jun 10, 9:53 PM (16 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33859526
Default Alt Text
D10315.id.diff (2 KB)
Attached To
Mode
D10315: regex(3): Consistently handle invalid {} constructs between BREs and EREs
Attached
Detach File
Event Timeline
Log In to Comment