aboutsummaryrefslogtreecommitdiff
path: root/opcodes/cgen-dis.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-05-12 11:44:04 +0930
committerAlan Modra <amodra@gmail.com>2022-05-12 11:49:45 +0930
commit5e39ef33fddf8decedb5f3ac0e90559cd04476ab (patch)
tree7e704afb0e771705b98d60c94d3df9d282465e95 /opcodes/cgen-dis.c
parentfa445221958a9b8c8c4a804a339bc54cedfd83b9 (diff)
downloadfsf-binutils-gdb-5e39ef33fddf8decedb5f3ac0e90559cd04476ab.zip
fsf-binutils-gdb-5e39ef33fddf8decedb5f3ac0e90559cd04476ab.tar.gz
fsf-binutils-gdb-5e39ef33fddf8decedb5f3ac0e90559cd04476ab.tar.bz2
cgen: increase buffer for hash_insn_list
As was done for hash_insn_array in commit d3d1cc7b13b4. * cgen-dis.c (hash_insn_list): Increase size of buf. Assert size is large enough.
Diffstat (limited to 'opcodes/cgen-dis.c')
-rw-r--r--opcodes/cgen-dis.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index 4137e39..993deeb 100644
--- a/opcodes/cgen-dis.c
+++ b/opcodes/cgen-dis.c
@@ -153,8 +153,9 @@ hash_insn_list (CGEN_CPU_DESC cd,
for (ilist = insns; ilist != NULL; ilist = ilist->next, ++ hentbuf)
{
unsigned int hash;
- char buf[4];
+ char buf[8];
unsigned long value;
+ size_t size;
if (! (* cd->dis_hash_p) (ilist->insn))
continue;
@@ -163,10 +164,9 @@ hash_insn_list (CGEN_CPU_DESC cd,
to hash on, so set both up. */
value = CGEN_INSN_BASE_VALUE (ilist->insn);
- bfd_put_bits((bfd_vma) value,
- buf,
- CGEN_INSN_MASK_BITSIZE (ilist->insn),
- big_p);
+ size = CGEN_INSN_MASK_BITSIZE (ilist->insn);
+ OPCODES_ASSERT (size <= sizeof (buf) * 8);
+ bfd_put_bits ((bfd_vma) value, buf, size, big_p);
hash = (* cd->dis_hash) (buf, value);
add_insn_to_hash_chain (hentbuf, ilist->insn, htable, hash);
}