More fixes for memory access errors triggered by attemps to examine corrupted binaries.
[deliverable/binutils-gdb.git] / bfd / pe-mips.c
index 57ec51fe19c52c40409f27c7626cc1fb1802c8a1..d7edc2b6837edf9eae69360054f978723ec7d663 100644 (file)
@@ -349,8 +349,11 @@ static reloc_howto_type howto_table[] =
 /* Customize coffcode.h.  */
 #define MIPS 1
 
-#define RTYPE2HOWTO(cache_ptr, dst) \
-           (cache_ptr)->howto = howto_table + (dst)->r_type;
+#define RTYPE2HOWTO(cache_ptr, dst)                            \
+  ((cache_ptr)->howto =                                                \
+   ((dst)->r_type < NUM_HOWTOS                                 \
+    ? howto_table + (dst)->r_type                              \
+    : NULL))
 
 /* Compute the addend of a reloc.  If the reloc is to a common symbol,
    the object file contains the value of the common symbol.  By the
This page took 0.024309 seconds and 4 git commands to generate.