aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-08-11 10:56:35 +0000
committerNick Clifton <nickc@redhat.com>1999-08-11 10:56:35 +0000
commit230801466aa11b7c986db17c3f25f8df0390444e (patch)
tree10a9186cc0c467c4e7508d8c2eff89afb727c0a0 /bfd
parentb100be66954be1dd02491bc9a3a7be9b0c28db97 (diff)
downloadgdb-230801466aa11b7c986db17c3f25f8df0390444e.zip
gdb-230801466aa11b7c986db17c3f25f8df0390444e.tar.gz
gdb-230801466aa11b7c986db17c3f25f8df0390444e.tar.bz2
Check for overflow on R_ARM_PC24 relocs.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-arm.h12
2 files changed, 14 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 645b118..13b8a66 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+1999-08-11 Robin Farine <advanc@dial.eunet.ch>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Check for overflow
+ in R_ARM_PC24 relocs.
+
Tue Aug 10 12:48:09 1999 Jeffrey A Law (law@cygnus.com)
* elf-hppa.h (elf_hppa_fake_sections): New function.
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index 78ecae1..6b2cabd 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -1223,10 +1223,16 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
value -= 8;
}
}
+
+ /* Perform a signed range check. */
+ signed_addend = value;
+ signed_addend >>= howto->rightshift;
+ if (signed_addend > ((bfd_signed_vma)(howto->dst_mask >> 1))
+ || signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1)))
+ return bfd_reloc_overflow;
- value >>= howto->rightshift;
- value &= howto->dst_mask;
- value |= (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
+ value = (signed_addend & howto->dst_mask)
+ | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
break;
case R_ARM_ABS32: