1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-18 00:05:13 +00:00

Fix some issues found with -fsanitize=undefined

Leave in issues with calling memcpy with size=0. If these
become a problem, will probably add a janet_memcpy as memcpy
is used so much in the code without 0 checks.
This commit is contained in:
Calvin Rose
2019-03-04 11:17:34 -05:00
parent 624be87c97
commit b07adce2b9
6 changed files with 28 additions and 20 deletions

View File

@@ -49,7 +49,7 @@ static const uint32_t symchars[8] = {
/* Check if a character is a valid symbol character
* symbol chars are A-Z, a-z, 0-9, or one of !$&*+-./:<=>@\^_~| */
static int is_symbol_char(uint8_t c) {
return symchars[c >> 5] & (1 << (c & 0x1F));
return symchars[c >> 5] & ((uint32_t)1 << (c & 0x1F));
}
/* Validate some utf8. Useful for identifiers. Only validates