From 63d65a59ae3480a564df2da0a5409b13a889ac4d Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Fri, 3 Jan 2020 12:17:04 -0500 Subject: [PATCH] Pass pointer to (char*) instead of (zend_string*) to spprintf I don't believe these error messages have any unit tests covering them. Some may be unreachable in practice. This might not be comprehensive - I didn't test other files. ``` struct _zend_class_entry { char type; zend_string *name; ``` --- v8js_object_export.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 9aac1fc..d8f90a1 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -496,7 +496,7 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) if (info.Length() < 2) { error_len = spprintf(&error, 0, "%s::__call expects 2 parameters, %d given", - ce->name, (int) info.Length()); + ZSTR_VAL(ce->name), (int) info.Length()); if (error_len > std::numeric_limits::max()) { zend_throw_exception(php_ce_v8js_exception, @@ -535,7 +535,7 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) // in the Function->Call method below is a (signed) int. error_len = spprintf(&error, 0, "%s::__call expects fewer than a million arguments", - ce->name); + ZSTR_VAL(ce->name)); if (error_len > std::numeric_limits::max()) { zend_throw_exception(php_ce_v8js_exception, @@ -555,8 +555,8 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) if (str.IsEmpty()) { error_len = spprintf(&error, 0, - "%s::__call expect 1st parameter to be valid function name, toString() invocation failed.", - ce->name); + "%s::__call expects 1st parameter to be valid function name, toString() invocation failed.", + ZSTR_VAL(ce->name)); if (error_len > std::numeric_limits::max()) { zend_throw_exception(php_ce_v8js_exception, @@ -584,7 +584,7 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) (method_ptr->common.fn_flags & ZEND_ACC_PUBLIC) == 0 || (method_ptr->common.fn_flags & (ZEND_ACC_CTOR|ZEND_ACC_DTOR)) != 0) { error_len = spprintf(&error, 0, - "%s::__call to %s method %s", ce->name, + "%s::__call to %s method %s", ZSTR_VAL(ce->name), (method_ptr == NULL) ? "undefined" : "non-public", method_name); if (error_len > std::numeric_limits::max()) {