mirror of
https://github.com/phpv8/v8js.git
synced 2025-01-03 11:21:51 +00:00
v8js_v8: add size check + precission down cast
This commit is contained in:
parent
db7c81d4fa
commit
ab8613f41b
11
v8js_v8.cc
11
v8js_v8.cc
@ -65,8 +65,15 @@ void v8js_v8_init(TSRMLS_D) /* {{{ */
|
||||
|
||||
/* Set V8 command line flags (must be done before V8::Initialize()!) */
|
||||
if (v8js_process_globals.v8_flags) {
|
||||
v8::V8::SetFlagsFromString(v8js_process_globals.v8_flags,
|
||||
strlen(v8js_process_globals.v8_flags));
|
||||
size_t flags_len = strlen(v8js_process_globals.v8_flags);
|
||||
|
||||
if (flags_len > std::numeric_limits<uint32_t>::max()) {
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Length of V8 flags exceeds maximum supported length", 0);
|
||||
}
|
||||
else {
|
||||
v8::V8::SetFlagsFromString(v8js_process_globals.v8_flags, static_cast<int>(flags_len));
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize V8 */
|
||||
|
Loading…
Reference in New Issue
Block a user