Check code point range in Str_BaseX_To_I64 Avoid undefined behavior when calling ctype.h functions.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/8e136eda Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/8e136eda Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/8e136eda Branch: refs/heads/master Commit: 8e136edacf5e531101e8bbf165fe7a8b1e005264 Parents: a6bfd28 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Wed Apr 6 13:29:23 2016 +0200 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Wed Apr 6 13:29:23 2016 +0200 ---------------------------------------------------------------------- runtime/core/Clownfish/String.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e136eda/runtime/core/Clownfish/String.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/String.c b/runtime/core/Clownfish/String.c index f619673..633aa80 100644 --- a/runtime/core/Clownfish/String.c +++ b/runtime/core/Clownfish/String.c @@ -243,7 +243,7 @@ Str_BaseX_To_I64_IMP(String *self, uint32_t base) { // Accumulate. while (code_point != STR_OOB) { - if (isalnum(code_point)) { + if (code_point <= 127 && isalnum(code_point)) { int32_t addend = isdigit(code_point) ? code_point - '0' : tolower(code_point) - 'a' + 10;