This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix readelf segv


Exposed a cut-and-paste error in some code I'm working on.  ;-)


r~


        * readelf.c (display_debug_frames): Don't crash for mismatched
        DW_CFA_restore_state.

Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.231
diff -c -p -d -r1.231 readelf.c
*** readelf.c	23 Feb 2004 08:45:05 -0000	1.231
--- readelf.c	22 Mar 2004 03:54:35 -0000
*************** display_debug_frames (Elf_Internal_Shdr 
*** 9150,9162 ****
  	      if (! do_debug_frames_interp)
  		printf ("  DW_CFA_restore_state\n");
  	      rs = remembered_state;
! 	      remembered_state = rs->next;
! 	      frame_need_space (fc, rs->ncols-1);
! 	      memcpy (fc->col_type, rs->col_type, rs->ncols);
! 	      memcpy (fc->col_offset, rs->col_offset, rs->ncols * sizeof (int));
! 	      free (rs->col_type);
! 	      free (rs->col_offset);
! 	      free (rs);
  	      break;
  
  	    case DW_CFA_def_cfa:
--- 9150,9168 ----
  	      if (! do_debug_frames_interp)
  		printf ("  DW_CFA_restore_state\n");
  	      rs = remembered_state;
! 	      if (rs)
! 		{
! 		  remembered_state = rs->next;
! 		  frame_need_space (fc, rs->ncols-1);
! 		  memcpy (fc->col_type, rs->col_type, rs->ncols);
! 		  memcpy (fc->col_offset, rs->col_offset,
! 			  rs->ncols * sizeof (int));
! 		  free (rs->col_type);
! 		  free (rs->col_offset);
! 		  free (rs);
! 		}
! 	      else if (do_debug_frames_interp)
! 		printf ("Mismatched DW_CFA_restore_state\n");
  	      break;
  
  	    case DW_CFA_def_cfa:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]