🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Eirik Fuller Thu, 27 Jul 1989 19:51
null pointer dereferences in gdb-3.2
#215
Author: Eirik Fuller
Date: Thu, 27 Jul 1989 19:51
161 lines
4611 bytes
The enclosed diffs provide a workaround for gdb segmentation faults.
If there is supposed to be a guarantee that TYPE_FIELD_NAME etc are
non-nil, this guarantee sometimes fails; if appropriate, I can
probably send examples of how to make this happen.  If there is no
such guarantee, this might be the right fix.  In any case, I doubt
these patches break anything.

*** ../gdb-3.2/valops.c	Wed Jul  5 12:46:58 1989
--- valops.c	Mon Jul 17 14:56:56 1989
***************
*** 816,822
  	{
  	  for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	    {
! 	      if (!strcmp (TYPE_FIELD_NAME (t, i), name))
  		{
  		  found = 1;
  		  break;

--- 816,823 -----
  	{
  	  for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	    {
! 	      char *tfn = TYPE_FIELD_NAME (t, i);
! 	      if (tfn && !strcmp (tfn, name))
  		{
  		  found = 1;
  		  break;
***************
*** 846,852
  	{
  	  for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
  	    {
! 	      if (! strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
  		{
  		  error ("use `info method' command to print value of method \"%s\"", name);
  		}

--- 847,854 -----
  	{
  	  for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
  	    {
! 	      char *tfn = TYPE_FN_FIELDLIST_NAME (t, i);
! 	      if (tfn && ! strcmp (tfn, name))
  		{
  		  error ("use `info method' command to print value of method \"%s\"", name);
  		}
***************
*** 886,892
  	{
  	  struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
  
! 	  if (!strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
  	    {
  	      int j;
  	      struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);

--- 888,895 -----
  	{
  	  struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
  
! 	  char *tfn = TYPE_FN_FIELDLIST_NAME (t, i);
! 	  if (tfn && !strcmp (tfn, name))
  	    {
  	      int j;
  	      struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
***************
*** 925,931
  	{
  	  for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	    {
! 	      if (!strcmp (TYPE_FIELD_NAME (t, i), name))
  		{
  		  found = 1;
  		  break;

--- 928,935 -----
  	{
  	  for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	    {
! 	      char *tfn = TYPE_FIELD_NAME (t, i);
! 	      if (tfn && !strcmp (tfn, name))
  		{
  		  found = 1;
  		  break;
***************
*** 1013,1019
      {
        for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	{
! 	  if (!strcmp (TYPE_FIELD_NAME (t, i), name))
  	    {
  	      return 1;
  	    }

--- 1017,1024 -----
      {
        for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	{
! 	  char *tfn = TYPE_FIELD_NAME (t, i);
! 	  if (tfn && !strcmp (tfn, name))
  	    {
  	      return 1;
  	    }
***************
*** 1038,1044
      {
        for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
  	{
! 	  if (!strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
  	    return 1;
  	}
  

--- 1043,1050 -----
      {
        for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
  	{
! 	  char *tfn = TYPE_FN_FIELDLIST_NAME (t, i);
! 	  if (tfn && !strcmp (tfn, name))
  	    return 1;
  	}
  
***************
*** 1078,1084
      {
        for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	{
! 	  if (!strcmp (TYPE_FIELD_NAME (t, i), name))
  	    {
  	      if (TYPE_FIELD_PACKED (t, i))
  		error ("pointers to bitfield members not allowed");

--- 1084,1091 -----
      {
        for (i = TYPE_NFIELDS (t) - 1; i >= 0; i--)
  	{
! 	  char *tfn = TYPE_FIELD_NAME (t, i);
! 	  if (tfn && !strcmp (tfn, name))
  	    {
  	      if (TYPE_FIELD_PACKED (t, i))
  		error ("pointers to bitfield members not allowed");
***************
*** 1115,1121
      {
        for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
  	{
! 	  if (!strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
  	    {
  	      int j = TYPE_FN_FIELDLIST_LENGTH (t, i);
  	      struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);

--- 1122,1129 -----
      {
        for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
  	{
! 	  char *tfn = TYPE_FN_FIELDLIST_NAME (t, i);
! 	  if (tfn && !strcmp (tfn, name))
  	    {
  	      int j = TYPE_FN_FIELDLIST_LENGTH (t, i);
  	      struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads