0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 23:51:51 +00:00

Use alloca for variable-size array on stack

This commit is contained in:
Stefan Siegl 2014-11-13 01:21:15 +01:00
parent 5b736a6e92
commit d03641254d

View File

@ -478,10 +478,11 @@ static int php_v8js_v8_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) /
cb = v8::Local<v8::Function>::Cast(v8obj->Get(method_name)); cb = v8::Local<v8::Function>::Cast(v8obj->Get(method_name));
} }
v8::Local<v8::Value> jsArgv[argc]; v8::Local<v8::Value> *jsArgv = static_cast<v8::Local<v8::Value> *>(alloca(sizeof(v8::Local<v8::Value>) * argc));
v8::Local<v8::Value> js_retval; v8::Local<v8::Value> js_retval;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
new(&jsArgv[i]) v8::Local<v8::Value>;
jsArgv[i] = v8::Local<v8::Value>::New(isolate, zval_to_v8js(*argv[i], isolate TSRMLS_CC)); jsArgv[i] = v8::Local<v8::Value>::New(isolate, zval_to_v8js(*argv[i], isolate TSRMLS_CC));
} }