1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 01:37:19 +00:00
Fix segfault on macro arity mismatch in compile.c by adding missing return statements.
This commit is contained in:
Calvin Rose 2019-12-31 11:33:03 -05:00
parent bfb638cfc2
commit a15d841b5b
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
Unicode True
!echo "Program Files: ${PROGRAMFILES}"
# Version # Version
!define PRODUCT_VERSION "${VERSION}.0" !define PRODUCT_VERSION "${VERSION}.0"
VIProductVersion "${PRODUCT_VERSION}" VIProductVersion "${PRODUCT_VERSION}"

View File

@ -583,18 +583,21 @@ static int macroexpand1(
es = janet_formatc("macro arity mismatch, expected at most %d, got %d", maxar, arity); es = janet_formatc("macro arity mismatch, expected at most %d, got %d", maxar, arity);
c->result.macrofiber = NULL; c->result.macrofiber = NULL;
janetc_error(c, es); janetc_error(c, es);
return 0;
} }
/* Set env */ /* Set env */
fiberp->env = c->env; fiberp->env = c->env;
int lock = janet_gclock(); int lock = janet_gclock();
JanetSignal status = janet_continue(fiberp, janet_wrap_nil(), &x); Janet tempOut;
JanetSignal status = janet_continue(fiberp, janet_wrap_nil(), &tempOut);
janet_gcunlock(lock); janet_gcunlock(lock);
if (status != JANET_SIGNAL_OK) { if (status != JANET_SIGNAL_OK) {
const uint8_t *es = janet_formatc("(macro) %V", x); const uint8_t *es = janet_formatc("(macro) %V", tempOut);
c->result.macrofiber = fiberp; c->result.macrofiber = fiberp;
janetc_error(c, es); janetc_error(c, es);
return 0;
} else { } else {
*out = x; *out = tempOut;
} }
return 1; return 1;