This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/8] Bfd: Don't abort in cases where the size of a reloc is 3 bytes.
- From: John Darrington <john at darrington dot wattle dot id dot au>
- To: binutils at sourceware dot org
- Cc: John Darrington <john at darrington dot wattle dot id dot au>
- Date: Mon, 16 Jul 2018 15:59:57 +0200
- Subject: [PATCH 1/8] Bfd: Don't abort in cases where the size of a reloc is 3 bytes.
- References: <1531749604-17475-1-git-send-email-john@darrington.wattle.id.au>
* bfd/reloc.c (_bfd_clear_contents): Handle the case where size == 3.
---
bfd/reloc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 68bc8a8..3b42915 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1636,6 +1636,11 @@ _bfd_clear_contents (reloc_howto_type *howto,
case 2:
x = bfd_get_16 (input_bfd, location);
break;
+ case 3:
+ x = bfd_get_8 (input_bfd, location);
+ x <<= 16;
+ x |= bfd_get_16 (input_bfd, location + 1);
+ break;
case 4:
x = bfd_get_32 (input_bfd, location);
break;
@@ -1670,6 +1675,10 @@ _bfd_clear_contents (reloc_howto_type *howto,
case 2:
bfd_put_16 (input_bfd, x, location);
break;
+ case 3:
+ bfd_put_16 (input_bfd, x, location + 1);
+ bfd_put_8 (input_bfd, x >> 16, location);
+ break;
case 4:
bfd_put_32 (input_bfd, x, location);
break;
--
2.1.4