diff options
author | ache <ache@FreeBSD.org> | 2016-07-22 14:24:17 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2016-07-22 14:24:17 +0000 |
commit | 3f56839b4888f5f2140b74ea536b9a0cee3a5084 (patch) | |
tree | de0154f18a175a32c0020a7fc90088448957417c /lib/libc/regex/regcomp.c | |
parent | e3c997f56b8acb47dd382a8e4ced061d664ae7b2 (diff) | |
download | FreeBSD-src-3f56839b4888f5f2140b74ea536b9a0cee3a5084.zip FreeBSD-src-3f56839b4888f5f2140b74ea536b9a0cee3a5084.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() works for single byte locales only
(we can't do it for other ones). In previous state only first 256
wide chars 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 ae92f6a..9211f65 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(__collate_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 ( __collate_range_cmp(table, start, i) <= 0 - && __collate_range_cmp(table, i, finish) <= 0 + if ( __wcollate_range_cmp(start, i) <= 0 + && __wcollate_range_cmp(i, finish) <= 0 ) CHadd(p, cs, i); } |