This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 13/17] Regex: Use btowc when checking for accepting bytes.
- From: Arnold Robbins <arnold at skeeve dot com>
- To: carlos at redhat dot com, libc-alpha at sourceware dot org
- Date: Fri, 08 Dec 2017 11:16:59 +0200
- Subject: [PATCH 13/17] Regex: Use btowc when checking for accepting bytes.
- Authentication-results: sourceware.org; auth=none
This patch uses btowc to validate values that are less than SBC_MAX.
2017-11-30 Arnold D. Robbins <arnold@skeeve.com>
* posix/regexec.c (check_node_accept_bytes): Use btowc
for values less than SBC_MAX.
diff --git a/posix/regexec.c b/posix/regexec.c
index f14685a..dcdd33b 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -3686,6 +3686,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
const re_token_t *node = dfa->nodes + node_idx;
int char_len, elem_len;
int i;
+ wint_t wc;
if (BE (node->type == OP_UTF8_PERIOD, 0))
{
@@ -3755,7 +3756,8 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
}
elem_len = re_string_elem_size_at (input, str_idx);
- if ((elem_len <= 1 && char_len <= 1) || char_len == 0)
+ wc = __btowc(*(input->mbs+str_idx));
+ if (((elem_len <= 1 && char_len <= 1) || char_len == 0) && (wc != WEOF && wc < SBC_MAX))
return 0;
if (node->type == COMPLEX_BRACKET)