From: Felipe Pena Date: Mon, 6 Oct 2008 00:35:20 +0000 (+0000) Subject: - Fixed bug #46238 (Segmentation fault on static call with empty string method) X-Git-Tag: BEFORE_HEAD_NS_CHANGE~281 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d4b0f20f94c688c8bc3b54f6725ab8631715cdf;p=php - Fixed bug #46238 (Segmentation fault on static call with empty string method) --- diff --git a/Zend/tests/bug46238.phpt b/Zend/tests/bug46238.phpt new file mode 100644 index 0000000000..e8281f1f3c --- /dev/null +++ b/Zend/tests/bug46238.phpt @@ -0,0 +1,120 @@ +--TEST-- +Bug #46238 (Segmentation fault on static call with empty string method) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + unicode(1) "a" + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + array(0) { + } + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + NULL + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + int(1) + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(0) { + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + unicode(1) "a" + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + array(0) { + } + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + NULL + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(1) { + [0]=> + int(1) + } +} +array(2) { + [0]=> + unicode(0) "" + [1]=> + array(0) { + } +} diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e795d17608..1af730b51c 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2038,7 +2038,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS } } if(OP2_TYPE != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_free_op free_op2; zend_uchar function_name_type; @@ -2059,7 +2059,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 4f2fac5e90..1c4cb5663e 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2707,7 +2707,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( } } if(IS_CONST != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_uchar function_name_type; @@ -2728,7 +2728,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -3311,7 +3311,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE } } if(IS_TMP_VAR != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_free_op free_op2; zend_uchar function_name_type; @@ -3332,7 +3332,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -3791,7 +3791,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE } } if(IS_VAR != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_free_op free_op2; zend_uchar function_name_type; @@ -3812,7 +3812,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -4027,7 +4027,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER } } if(IS_UNUSED != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_uchar function_name_type; @@ -4048,7 +4048,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -4475,7 +4475,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN } } if(IS_CV != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_uchar function_name_type; @@ -4496,7 +4496,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -10771,7 +10771,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE } } if(IS_CONST != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_uchar function_name_type; @@ -10792,7 +10792,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -12686,7 +12686,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND } } if(IS_TMP_VAR != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_free_op free_op2; zend_uchar function_name_type; @@ -12707,7 +12707,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -14581,7 +14581,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND } } if(IS_VAR != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_free_op free_op2; zend_uchar function_name_type; @@ -14602,7 +14602,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -15564,7 +15564,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z } } if(IS_UNUSED != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_uchar function_name_type; @@ -15585,7 +15585,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else { @@ -17093,7 +17093,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ } } if(IS_CV != IS_UNUSED) { - zstr function_name_strval; + zstr function_name_strval = NULL_ZSTR; unsigned int function_name_strlen = 0; zend_uchar function_name_type; @@ -17114,7 +17114,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ } } - if (function_name_strlen) { + if (function_name_strval.v) { if (ce->get_static_method) { EX(fbc) = ce->get_static_method(ce, function_name_type, function_name_strval, function_name_strlen TSRMLS_CC); } else {