mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 23:23:07 +00:00 
			
		
		
		
	Address #232
Fix segfault on macro arity mismatch in compile.c by adding missing return statements.
This commit is contained in:
		| @@ -583,18 +583,21 @@ static int macroexpand1( | ||||
|             es = janet_formatc("macro arity mismatch, expected at most %d, got %d", maxar, arity); | ||||
|         c->result.macrofiber = NULL; | ||||
|         janetc_error(c, es); | ||||
|         return 0; | ||||
|     } | ||||
|     /* Set env */ | ||||
|     fiberp->env = c->env; | ||||
|     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); | ||||
|     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; | ||||
|         janetc_error(c, es); | ||||
|         return 0; | ||||
|     } else { | ||||
|         *out = x; | ||||
|         *out = tempOut; | ||||
|     } | ||||
|  | ||||
|     return 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose