diff options
author | ache <ache@FreeBSD.org> | 2016-08-17 08:51:47 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2016-08-17 08:51:47 +0000 |
commit | 02a43cd8e225e88b473b2b949679176be6ad4cff (patch) | |
tree | 1978889bd9995a93b31f901bbef5c2f48e058db5 /lib/libc/regex/regcomp.c | |
parent | ad158962010209479efd5322cb0bcca8e5ebb9f9 (diff) | |
download | FreeBSD-src-02a43cd8e225e88b473b2b949679176be6ad4cff.zip FreeBSD-src-02a43cd8e225e88b473b2b949679176be6ad4cff.tar.gz |
MFC r302824
1) Eliminate possibility to call __*collate_range_cmp() with inclomplete
locale (which cause core dump) by removing whole 'table' argument
by which it passed.
2) Restore __collate_range_cmp() in __sccl().
3) Collating [a-z] range in regcomp() work only for single bytes locales
(we can't do it now for other ones). In previous code only first 256
wchars are considered and all others are just silently dropped from the
range.
Diffstat (limited to 'lib/libc/regex/regcomp.c')
-rw-r--r-- | lib/libc/regex/regcomp.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 5333233..b2b1255 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include <limits.h> #include <stdlib.h> #include <regex.h> -#include <runetype.h> #include <wchar.h> #include <wctype.h> @@ -817,14 +816,14 @@ p_b_term(struct parse *p, cset *cs) if (start == finish) CHadd(p, cs, start); else { - if (table->__collate_load_error) { - (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE); + if (table->__collate_load_error || MB_CUR_MAX > 1) { + (void)REQUIRE(start <= finish, REG_ERANGE); CHaddrange(p, cs, start, finish); } else { - (void)REQUIRE(__wcollate_range_cmp(table, start, finish) <= 0, REG_ERANGE); + (void)REQUIRE(__wcollate_range_cmp(start, finish) <= 0, REG_ERANGE); for (i = 0; i <= UCHAR_MAX; i++) { - if ( __wcollate_range_cmp(table, start, i) <= 0 - && __wcollate_range_cmp(table, i, finish) <= 0 + if ( __wcollate_range_cmp(start, i) <= 0 + && __wcollate_range_cmp(i, finish) <= 0 ) CHadd(p, cs, i); } |