Bug #70773 [Opn]: Segmentation fault (core dumped)
| From: | laruence@php.net | Date: | Fri, 23 Oct 2015 04:09:22 +0000 |
| Subject: | Bug #70773 [Opn]: Segmentation fault (core dumped) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196761@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70773&edit=1
ID: 70773
Updated by: laruence@php.net
Reported by: svein at vip dot qq dot com
Summary: Segmentation fault (core dumped)
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Linux 2.6.33.15
PHP Version: 7.0.0RC5
Block user comment: N
Private report: N
New Comment:
use:
size_t function_name_len = 0;
Previous Comments:
------------------------------------------------------------------------
[2015-10-23 03:52:23] svein at vip dot qq dot com
Description:
------------
I wrote a PHP extension function my_test:
PHP_FUNCTION(my_test)
{
long type = 0;
char *function_name = NULL;
int function_name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type
,&function_name,&function_name_len) == FAILURE)
{
zend_error(E_ERROR, "my_test zend_parse_parameters error");
}
RETURN_LONG(1);
}
when i call this function in a php file
php crash with Segmentation fault (core dumped)
but
when i modify mytest toï¼
PHP_FUNCTION(my_test)
{
long type = 0;
char *function_name = NULL;
int function_name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type
,&function_name,&function_name_len) == FAILURE)
{
zend_error(E_ERROR, "my_test zend_parse_parameters error");
}
}
or
PHP_FUNCTION(my_test)
{
long type = 0;
char *function_name = NULL;
int function_name_len = 0;
RETURN_LONG(1);
}
php run ok
Test script:
---------------
PHP_FUNCTION(my_test)
{
long type = 0;
char *function_name = NULL;
int function_name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type
,&function_name,&function_name_len) == FAILURE)
{
zend_error(E_ERROR, "my_test zend_parse_parameters error");
}
RETURN_LONG(1);
}
Expected result:
----------------
ok
Actual result:
--------------
Segmentation fault (core dumped)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70773&edit=1