Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/brpc/uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int URI::SetHttpURL(const char* url) {
bool need_scheme = true;
bool need_user_info = true;
for (; true; ++p) {
const char action = g_url_parsing_fast_action_map[(int)*p];
const char action = g_url_parsing_fast_action_map[(signed char)*p];
if (action == URI_PARSE_CONTINUE) {
continue;
}
Expand Down Expand Up @@ -256,7 +256,7 @@ int ParseURL(const char* url,
bool need_scheme = true;
bool need_user_info = true;
for (; true; ++p) {
const char action = g_url_parsing_fast_action_map[(int)*p];
const char action = g_url_parsing_fast_action_map[(signed char)*p];
if (action == URI_PARSE_CONTINUE) {
continue;
}
Expand Down
6 changes: 5 additions & 1 deletion src/butil/containers/case_ignored_flat_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ namespace butil {
// note: using char caused crashes on ubuntu 20.04 aarch64 (VM on apple M1)
inline char ascii_tolower(int/*note*/ c) {
extern const signed char* const g_tolower_map;
return g_tolower_map[c];
// g_tolower_map is biased by +128 and sized for a signed-char index
// ([-128,127]). Callers pass a `char`; on platforms where `char` is
// unsigned (aarch64, riscv64) a byte >= 0x80 arrives here as 128..255 and
// indexes past the 256-entry table. Fold back into signed-char range.
return g_tolower_map[(signed char)c];
}

struct CaseIgnoredHasher {
Expand Down
Loading