[xdebug-dev] xdebug xdebug/xdebug_handler_gdb.c xdebug/xdebug_var.c - Fixed a couple of segfaults with uninitialized variables with the GDB

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Tue, 13 Apr 2004 22:33:46 +0200

Date: Tue Apr 13 22:33:45 CEST 2004
User: Derick Rethans
Directory: xdebug

Log Message:
[0.75]
- Fixed a couple of segfaults with uninitialized variables with the GDB
  protocol.

Modified files:
           xdebug/xdebug_handler_gdb.c (version: 1.73)
           xdebug/xdebug_var.c (version: 1.44)

[FILE: /xdebug/xdebug_handler_gdb.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- xdebug/xdebug_handler_gdb.c:1.72 Tue Apr 13 12:00:00 2004 GMT
+++ xdebug/xdebug_handler_gdb.c Tue Apr 13 18:33:45 2004 GMT
@@ -328,7 +328,11 @@
 
         switch (options->response_format) {
                    case XDEBUG_RESPONSE_NORMAL:
- str_rep = get_zval_value(val);
+ if (val) {
+ str_rep = get_zval_value(val);
+ } else {
+ str_rep = xdstrdup("*uninitialized*");
+ }
                         if (name) {
                                 ret = xdebug_sprintf("$%s = %s\n", name, str_rep);
                         } else {
@@ -508,9 +512,7 @@
                 if (i->vars[j].name) {
                    SENDMSG(h->socket, xdebug_sprintf("$%s = ", i->vars[j].name));
                 }
- if (!i->vars[j].addr) {
- tmp_value = get_zval_value(i->vars[j].addr);
- }
+ tmp_value = get_zval_value(i->vars[j].addr);
                 tmp = xmlize(tmp_value);
                 SSEND(h->socket, tmp);
                 xdfree(tmp_value);
@@ -565,9 +567,7 @@
                 if (i->vars[j].name) {
                    SENDMSG(h->socket, xdebug_sprintf("$%s = ", i->vars[j].name));
                 }
- if (!i->vars[j].addr) {
- tmp_value = get_zval_value(i->vars[j].addr);
- }
+ tmp_value = get_zval_value(i->vars[j].addr);
                 tmp = xmlize(tmp_value);
                 SSEND(h->socket, tmp);
                 xdfree(tmp_value);
@@ -1321,7 +1321,7 @@
 
 char *xdebug_gdb_get_revision(void)
 {
- return "$Revision: 1.72 $";
+ return "$Revision: 1.73 $";
 }
 
 int xdebug_gdb_init(xdebug_con *context, int mode, char *magic_cookie)

[FILE: /xdebug/xdebug_var.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- xdebug/xdebug_var.c:1.43 Thu Mar 04 10:46:45 2004 GMT
+++ xdebug/xdebug_var.c Tue Apr 13 18:33:45 2004 GMT
@@ -288,6 +288,11 @@
         HashTable *myht;
         char* tmp_str;
 
+ if (!*struc) {
+ xdebug_str_addl(str, "<uninitialized/>", 16, 0);
+ return;
+ }
+
         switch (Z_TYPE_PP(struc)) {
                 case IS_BOOL:
                         xdebug_str_add(str, xdebug_sprintf("<bool>%s</bool>", Z_LVAL_PP(struc) ? "1" : "0"), 1);
Received on Tue Apr 13 2004 - 22:33:47 BST

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