[xdebug-dev] xdebug xdebug/xdebug.c - Fixed bug #198: Segfault when trying to use a non-existing debug handler.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Thu, 7 Sep 2006 22:56:16 +0200

Date: Thu Sep 7 22:56:16 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Fixed bug #198: Segfault when trying to use a non-existing debug handler.

Modified files:
           xdebug/xdebug.c (version: 1.338)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.337
retrieving revision 1.338
diff -u -r1.337 -r1.338
--- xdebug/xdebug.c:1.337 Tue Sep 05 12:46:20 2006 GMT
+++ xdebug/xdebug.c Thu Sep 07 18:56:16 2006 GMT
@@ -1280,17 +1280,20 @@
                         /* Initialize debugging session */
                         XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port));
                         if (XG(context).socket >= 0) {
- XG(remote_enabled) = 1;
+ XG(remote_enabled) = 0;
+ XG(context).program_name = xdstrdup(op_array->filename);
 
                                 /* Get handler from mode */
                                 XG(context).handler = xdebug_handler_get(XG(remote_handler));
- XG(context).program_name = xdstrdup(op_array->filename);
- if (!XG(context).handler->remote_init(&(XG(context)), XDEBUG_REQ)) {
- XG(remote_enabled) = 0;
+ if (!XG(context).handler) {
+ zend_error(E_WARNING, "The remote debug handler '%s' is not supported.", XG(remote_handler));
+ } else if (!XG(context).handler->remote_init(&(XG(context)), XDEBUG_REQ)) {
+ /* The request could not be started, ignore it then */
+ } else {
+ /* All is well, turn off script time outs */
+ zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), "0", strlen("0"), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+ XG(remote_enabled) = 1;
                                 }
-
- /* Turn off script time outs */
- zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), "0", strlen("0"), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
                         }
                 }
 
@@ -1867,12 +1870,20 @@
         if (!XG(remote_enabled) && XG(remote_enable) && (XG(remote_mode) == XDEBUG_JIT)) {
                 XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port));
                 if (XG(context).socket >= 0) {
- XG(remote_enabled) = 1;
+ XG(remote_enabled) = 0;
                         XG(context).program_name = NULL;
 
                         /* Get handler from mode */
                         XG(context).handler = xdebug_handler_get(XG(remote_handler));
- XG(context).handler->remote_init(&(XG(context)), XDEBUG_JIT);
+ if (!XG(context).handler) {
+ zend_error(E_WARNING, "The remote debug handler '%s' is not supported.", XG(remote_handler));
+ } else if (!XG(context).handler->remote_init(&(XG(context)), XDEBUG_REQ)) {
+ /* The request could not be started, ignore it then */
+ } else {
+ /* All is well, turn off script time outs */
+ zend_alter_ini_entry("max_execution_time", sizeof("max_execution_time"), "0", strlen("0"), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+ XG(remote_enabled) = 1;
+ }
                 }
         }
         if (XG(remote_enabled)) {
Received on Thu Sep 07 2006 - 22:56:34 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST