Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146746552
D50733.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D50733.id.diff
View Options
diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c
--- a/lib/libc/locale/collate.c
+++ b/lib/libc/locale/collate.c
@@ -359,7 +359,7 @@
*len = l;
*pri = p;
- } else if (*t <= UCHAR_MAX) {
+ } else if (*t >= 0 && *t <= UCHAR_MAX) {
/*
* Character is a small (8-bit) character.
@@ -699,12 +699,17 @@
struct xlocale_collate *table =
(struct xlocale_collate*)locale->components[XLC_COLLATE];
- if (table->__collate_load_error)
- return ((len == 1 && *str <= UCHAR_MAX) ? *str : -1);
+ if (table->__collate_load_error) {
+ if (len != 1)
+ return (-1);
+ if (*str < 0 || *str > UCHAR_MAX)
+ return (-1);
+ return (*str);
+ }
if (len == 1) {
e = -1;
- if (*str <= UCHAR_MAX)
+ if (*str >= 0 && *str <= UCHAR_MAX)
e = table->char_pri_table[*str].pri[0];
else if (table->info->large_count > 0) {
collate_large_t *match_large;
@@ -781,7 +786,7 @@
if (len == 0 || len > dlen)
return ((size_t)-1);
if (len == 1) {
- if (*wname <= UCHAR_MAX) {
+ if (*wname >= 0 && *wname <= UCHAR_MAX) {
if (table->char_pri_table[*wname].pri[0] >= 0) {
if (dlen > 0)
*dst = *wname;
@@ -853,7 +858,7 @@
return (-1);
if (len == 1) {
e = -1;
- if (*wname <= UCHAR_MAX)
+ if (*wname >= 0 && *wname <= UCHAR_MAX)
e = table->char_pri_table[*wname].pri[0];
else if (table->info->large_count > 0) {
collate_large_t *match;
@@ -946,7 +951,7 @@
}
/* try single character */
i = 1;
- if (*buf <= UCHAR_MAX) {
+ if (*buf >= 0 && *buf <= UCHAR_MAX) {
if (equiv_class == table->char_pri_table[*buf].pri[0])
goto found;
} else if (table->info->large_count > 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 6, 6:10 AM (3 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29138550
Default Alt Text
D50733.id.diff (1 KB)
Attached To
Mode
D50733: libc: locale: fix some assumptions that wchar_t cannot be signed
Attached
Detach File
Event Timeline
Log In to Comment