This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] avoid NULL deref for non GDB_MULTI_ARCH mips configs
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [RFA] avoid NULL deref for non GDB_MULTI_ARCH mips configs
- From: fnf at ninemoons dot com
- Date: Sun, 17 Sep 2000 19:57:42 -0700 (MST)
- Cc: fnf at cygnus dot com
- Reply-To: fnf at cygnus dot com
Currently any mips target that is not multi-arched (GDB_MULTI_ARCH == 0)
will attempt to dereference a NULL pointer in mips_mask_address_p, when it
unconditionally uses a gdbarch_tdep to look for the value of
default_mask_address_p. The tdep pointer is NULL.
Since the current default value is zero for all the multiarch cases,
I'm assuming the non-multiarch default can be zero also, for now.
Note that if there is a better place in mips-tdep.c to place the
definition of the new macro, feel free to change it.
Would the mips maintainer please review this patch and either apply
it or let me know what needs fixing. Thanks!
-Fred
===================================================================
2000-09-17 Fred Fish <fnf@cygnus.com>
* mips-tdep.c (MIPS_DEFAULT_MASK_ADDRESS_P): Define using either
the current arch or use zero.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/mips-tdep.c,v
retrieving revision 1.243
diff -c -p -r1.243 mips-tdep.c
*** mips-tdep.c 2000/08/11 00:28:27 1.243
--- mips-tdep.c 2000/09/18 02:49:40
*************** mips_stack_argsize (void)
*** 228,233 ****
--- 228,240 ----
#define GDB_TARGET_IS_MIPS64 (gdbarch_tdep (current_gdbarch)->gdb_target_is_mips64 + 0)
#endif
+ #if GDB_MULTI_ARCH
+ #undef MIPS_DEFAULT_MASK_ADDRESS_P
+ #define MIPS_DEFAULT_MASK_ADDRESS_P (gdbarch_tdep (current_gdbarch)->default_mask_address_p)
+ #elif !defined (MIPS_DEFAULT_MASK_ADDRESS_P)
+ #define MIPS_DEFAULT_MASK_ADDRESS_P (0)
+ #endif
+
#define VM_MIN_ADDRESS (CORE_ADDR)0x400000
int gdb_print_insn_mips (bfd_vma, disassemble_info *);
*************** mips_mask_address_p (void)
*** 472,478 ****
return 0;
break;
case CMD_AUTO_BOOLEAN_AUTO:
! return gdbarch_tdep (current_gdbarch)->default_mask_address_p;
default:
internal_error ("mips_mask_address_p: bad switch");
return -1;
--- 482,488 ----
return 0;
break;
case CMD_AUTO_BOOLEAN_AUTO:
! return MIPS_DEFAULT_MASK_ADDRESS_P;
default:
internal_error ("mips_mask_address_p: bad switch");
return -1;