musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/regex/regcomp.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2015年03月22日 18:32:55 +0000
committerRich Felker <dalias@aerifal.cx>2015年03月23日 12:28:49 -0400
commit32dee9b9b1e557a73cc4427455cd00cb2571436c (patch)
tree4a449ad0502c4591e977e8e982a0adc8d1633bf0 /src/regex/regcomp.c
parent11d1e2e2ded07673411ba872c1e3d0096dc79439 (diff)
downloadmusl-32dee9b9b1e557a73cc4427455cd00cb2571436c.tar.gz
do not treat 0円 as a backref in BRE
The valid BRE backref tokens are 1円 .. 9,円 and 0 is not a special character either so 0円 is undefined by the standard. Such undefined escaped characters are treated as literal characters currently, following existing practice, so 0円 is the same as 0.
Diffstat (limited to 'src/regex/regcomp.c')
-rw-r--r--src/regex/regcomp.c 2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index 4d80cb1c..dfa9727c 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -839,7 +839,7 @@ static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s)
s--;
break;
default:
- if (!ere && isdigit(*s)) {
+ if (!ere && (unsigned)*s-'1' < 9) {
/* back reference */
int val = *s - '0';
node = tre_ast_new_literal(ctx->mem, BACKREF, val, ctx->position);
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月08日 19:12:55 +0000

AltStyle によって変換されたページ (->オリジナル) /