summaryrefslogtreecommitdiff
path: root/opcodes/csky-dis.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-10-28 16:45:55 +0000
committerNick Clifton <nickc@redhat.com>2019-10-28 16:45:55 +0000
commit1ee3542c0a3830cac933ae56cc5f29e9c3f7c6ca (patch)
tree49bbee946b943145c67ba8dfdf6fe45f200c1bbb /opcodes/csky-dis.c
parentbbf9a0b5eef3599a1c6a7a3bea40da9f2c37df83 (diff)
downloadbinutils-gdb-1ee3542c0a3830cac933ae56cc5f29e9c3f7c6ca.tar.gz
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.
Diffstat (limited to 'opcodes/csky-dis.c')
-rw-r--r--opcodes/csky-dis.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index efd1f75052b..ffdb5964958 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--)