1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-06 18:43:04 +00:00

Fix ev thread swallowing error in some case.

This commit is contained in:
Calvin Rose
2021-08-27 11:46:42 -05:00
parent 0ab96b8e47
commit ab740f92db
4 changed files with 33 additions and 11 deletions

View File

@@ -953,6 +953,7 @@ static const uint8_t *unmarshal_one_fiber(
fiber->data = NULL;
fiber->child = NULL;
fiber->env = NULL;
fiber->last_value = janet_wrap_nil();
#ifdef JANET_EV
fiber->waiting = NULL;
fiber->sched_id = 0;
@@ -1257,7 +1258,7 @@ static const uint8_t *unmarshal_one(
data++;
int32_t len = readnat(st, &data);
if (len > 255) {
janet_panicf("invalid function");
janet_panicf("invalid function - too many environments (%d)", len);
}
func = janet_gcalloc(JANET_MEMORY_FUNCTION, sizeof(JanetFunction) +
len * sizeof(JanetFuncEnv));
@@ -1265,7 +1266,8 @@ static const uint8_t *unmarshal_one(
janet_v_push(st->lookup, *out);
data = unmarshal_one_def(st, data, &def, flags + 1);
if (def->environments_length != len) {
janet_panicf("invalid function");
janet_panicf("invalid function - env count does not match def (%d != %d)",
len, def->environments_length);
}
func->def = def;
for (int32_t i = 0; i < def->environments_length; i++) {