From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: Subject: [RFA] varobj.c: check wrapper return value Date: Wed, 10 Oct 2001 09:06:00 -0000 Message-id: X-SW-Source: 2001-10/msg00110.html Hi, Varobj has an unchecked return value from "gdb_value_ind" which can cause a segv from an invalid struct value. I presume that this should also go into 5.1 if it is not too late. (For that matter, so should the other changes to varobj.c -- all of which prevent segvs from happening. My bad.) Keith ChangeLog 2001-10-10 Keith Seitz * varobj.c (cplus_value_of_child): Deal with a failure to dereference a pointer object. Patch Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.20 diff -u -p -r1.20 varobj.c --- varobj.c 2001/08/17 18:56:49 1.20 +++ varobj.c 2001/10/10 15:59:38 @@ -2313,7 +2313,10 @@ cplus_value_of_child (struct varobj *par if (TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_PTR || TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_REF) - gdb_value_ind (parent->value, &temp); + { + if (!gdb_value_ind (parent->value, &temp)) + return NULL; + } else temp = parent->value;