如何修复PHP扩展中的“分段错误”错误

I configure php-7.1.0 with --enable-debug. But my extension can't get string param.Now it's "Segmentation fault",and it didn't occur without --enable-debug.

Is this a php problem or a problem with my code?

I've tried to use gdb to debug. It occurred in function “zend_parse_parameters”. And it's normal before running to the end of the function “zend_parse_arg_string”. The pointer of string was redirect to .

PHP_FUNCTION(sigTKeyEncrypt)
{
    array_init(return_value);
    const unsigned char *pInBuf = NULL;
    int nInBufLen, pOutBufLen;
    char pOutBuf[BUF_LEN] = { 0 };
    pOutBufLen = sizeof(pOutBuf);
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pInBuf, &nInBufLen) == FAILURE) {
        php_printf("zend_parse_parameters failed!
");
        add_assoc_long(return_value, "r", 99);
        return;
    }
    php_printf("buf:%s, bufLen:%d
", pInBuf, nInBufLen);

    OicqEncrypt(300, pInBuf, nInBufLen, (const BYTE*)SIG_TENCENT_KEY, (unsigned char*)pOutBuf, &pOutBufLen);

    add_assoc_long(return_value, "r", 0);
    add_assoc_stringl(return_value, "data", pOutBuf, pOutBufLen);
}

I expect the function “zend_parse_parameters” can read the string correctly with configure --enable-debug.