quickjs
quickjs copied to clipboard
Memory violation in JS_CallInternal
JSFunctionDef use int for var_count, but JSFunctionBytecode use uint16_t. And JS_MAX_LOCAL_VARS is 65536. So when we create exactly 65536 local vars, var_count in JSFunctionBytecode will overflow to zero at js_create_function. So it calculated a wrong alloca_size in JS_CallInternal.