MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add strict function body check and handle unexpected end of function

+6 -2
+6 -2
src/ant.c
··· 6837 6837 6838 6838 if (fnpos < fnlen && fn[fnpos] == ')') fnpos++; 6839 6839 fnpos = skiptonext(fn, fnlen, fnpos, NULL); 6840 - if (fnpos < fnlen && fn[fnpos] == '{') fnpos++; 6840 + if (fnpos >= fnlen) return js_mkerr(js, "unexpected end of function"); 6841 + if (fn[fnpos] == '{') fnpos++; 6841 6842 jsoff_t body_len = fnlen - fnpos - 1; 6842 6843 6843 6844 bool func_strict = is_strict_function_body(&fn[fnpos], body_len); ··· 14196 14197 } 14197 14198 14198 14199 static jsval_t builtin_Date_setYear(struct js *js, jsval_t *args, int nargs) { 14199 - if (nargs < 1) return tov(JS_NAN); 14200 + if (nargs < 1) { 14201 + date_set_time(js, js->this_val, JS_NAN); 14202 + return tov(JS_NAN); 14203 + } 14200 14204 double year_arg = tod(args[0]); 14201 14205 if (isnan(year_arg)) { 14202 14206 date_set_time(js, js->this_val, JS_NAN);