1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 23:53:02 +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

@@ -89,8 +89,9 @@ static void janetc_loadconst(JanetCompiler *c, Janet k, int32_t reg) {
int32_t i = (int32_t) dval;
if (dval != i || !(dval >= INT16_MIN && dval <= INT16_MAX))
goto do_constant;
uint32_t iu = (uint32_t)i;
janetc_emit(c,
(i << 16) |
(iu << 16) |
(reg << 8) |
JOP_LOAD_INTEGER);
break;