From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: cgen: increase buffer for hash_insn_list
Date: Thu, 12 May 2022 13:25:35 +0930 [thread overview]
Message-ID: <YnyFNyIfSn4PXtiV@squeak.grove.modra.org> (raw)
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.
diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index 4137e39bd38..993deeb26b4 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);
}
--
Alan Modra
Australia Development Lab, IBM
reply other threads:[~2022-05-12 3:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YnyFNyIfSn4PXtiV@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).