Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] varobj.c: check wrapper return value
@ 2001-10-10  9:06 Keith Seitz
  2001-10-10  9:52 ` Fernando Nasser
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2001-10-10  9:06 UTC (permalink / raw)
  To: gdb-patches

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  <keiths@redhat.com>

        * 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;




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] varobj.c: check wrapper return value
  2001-10-10  9:06 [RFA] varobj.c: check wrapper return value Keith Seitz
@ 2001-10-10  9:52 ` Fernando Nasser
  2001-10-10 10:02   ` Keith Seitz
  2001-10-10 11:01   ` Andrew Cagney
  0 siblings, 2 replies; 4+ messages in thread
From: Fernando Nasser @ 2001-10-10  9:52 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches, Andrew Cagney

Keith Seitz wrote:
> 
> 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
> 

Thanks.  Please check it in the trunk.

I can't tell about 5.1.  Andrew?

Fernando


> ChangeLog
> 2001-10-10  Keith Seitz  <keiths@redhat.com>
> 
>         * 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;

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] varobj.c: check wrapper return value
  2001-10-10  9:52 ` Fernando Nasser
@ 2001-10-10 10:02   ` Keith Seitz
  2001-10-10 11:01   ` Andrew Cagney
  1 sibling, 0 replies; 4+ messages in thread
From: Keith Seitz @ 2001-10-10 10:02 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: gdb-patches

On Wed, 10 Oct 2001, Fernando Nasser wrote:

> Thanks.  Please check it in the trunk.

Done. Thanks for the ultra-fast response!! What service!

Keith

> > ChangeLog
> > 2001-10-10  Keith Seitz  <keiths@redhat.com>
> >
> >         * 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;
>
> --
> Fernando Nasser
> Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario   M4P 2C9
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] varobj.c: check wrapper return value
  2001-10-10  9:52 ` Fernando Nasser
  2001-10-10 10:02   ` Keith Seitz
@ 2001-10-10 11:01   ` Andrew Cagney
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2001-10-10 11:01 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: Keith Seitz, gdb-patches, Andrew Cagney

> 
> Thanks.  Please check it in the trunk.
> 
> I can't tell about 5.1.  Andrew?

Really it is up to you and Keith.  What is its impact? If it is just MI 
and insight then it is very likely ok.

5.1 still has true64 and s390.  I think HP/UX 11 was resolved?

Andrew



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-10-10 11:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-10  9:06 [RFA] varobj.c: check wrapper return value Keith Seitz
2001-10-10  9:52 ` Fernando Nasser
2001-10-10 10:02   ` Keith Seitz
2001-10-10 11:01   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox