[binutils-gdb] Fix potentially illegal shift and assign operation in CSKY disassembler.
Nick Clifton
nickc@sourceware.org
Mon Oct 28 16:46:00 GMT 2019
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1ee3542c0a3830cac933ae56cc5f29e9c3f7c6ca
commit 1ee3542c0a3830cac933ae56cc5f29e9c3f7c6ca
Author: Nick Clifton <nickc@redhat.com>
Date: Mon Oct 28 16:45:55 2019 +0000
Fix potentially illegal shift and assign operation in CSKY disassembler.
* csky-dis.c (csky_chars_to_number): Check for a negative
count. Use an unsigned integer to construct the return value.
Diff:
---
opcodes/ChangeLog | 5 +++++
opcodes/csky-dis.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 8489b40..5f5a6c8 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,10 @@
2019-10-28 Nick Clifton <nickc@redhat.com>
+ * csky-dis.c (csky_chars_to_number): Check for a negative
+ count. Use an unsigned integer to construct the return value.
+
+2019-10-28 Nick Clifton <nickc@redhat.com>
+
* tic30-dis.c (OPERAND_BUFFER_LEN): Define. Use as length of
operand buffer. Set value to 15 not 13.
(get_register_operand): Use OPERAND_BUFFER_LEN.
diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index efd1f75..ffdb596 100644
--- a/opcodes/csky-dis.c
+++ b/opcodes/csky-dis.c
@@ -134,10 +134,10 @@ csky_get_mask (struct csky_opcode_info const *pinfo)
static unsigned int
csky_chars_to_number (unsigned char * buf, int n)
{
- if (n == 0)
+ if (n <= 0)
abort ();
int i;
- int val = 0;
+ unsigned int val = 0;
if (dis_info.info->endian == BFD_ENDIAN_BIG)
while (n--)
More information about the Binutils-cvs
mailing list