diff options
-rw-r--r-- | bfd/som.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -5251,7 +5251,9 @@ som_set_reloc_info (unsigned char *fixup, section->contents = contents; deallocate_contents = 1; } - else if (rptr->addend == 0) + if (rptr->addend == 0 + && offset - var ('L') <= section->size + && section->size - (offset - var ('L')) >= 4) rptr->addend = bfd_get_32 (section->owner, (section->contents + offset - var ('L'))); @@ -5269,7 +5271,10 @@ som_set_reloc_info (unsigned char *fixup, } } if (deallocate_contents) - free (section->contents); + { + free (section->contents); + section->contents = NULL; + } return count; |