bpf stack smashing detected
* cgen-dis.c (hash_insn_array): Increase size of buf. Assert size is large enough.
This commit is contained in:
parent
8eca5c7d9f
commit
d3d1cc7b13
2 changed files with 11 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2020-06-05 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* cgen-dis.c (hash_insn_array): Increase size of buf. Assert
|
||||||
|
size is large enough.
|
||||||
|
|
||||||
2020-06-04 Jose E. Marchesi <jose.marchesi@oracle.com>
|
2020-06-04 Jose E. Marchesi <jose.marchesi@oracle.com>
|
||||||
|
|
||||||
* disassemble.c (disassemble_init_for_target): Set endian_code for
|
* disassemble.c (disassemble_init_for_target): Set endian_code for
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "symcat.h"
|
#include "symcat.h"
|
||||||
#include "opcode/cgen.h"
|
#include "opcode/cgen.h"
|
||||||
|
#include "disassemble.h"
|
||||||
|
|
||||||
static CGEN_INSN_LIST * hash_insn_array (CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
|
static CGEN_INSN_LIST * hash_insn_array (CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
|
||||||
static CGEN_INSN_LIST * hash_insn_list (CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
|
static CGEN_INSN_LIST * hash_insn_list (CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
|
||||||
|
@ -110,9 +111,10 @@ hash_insn_array (CGEN_CPU_DESC cd,
|
||||||
for (i = count - 1; i >= 0; --i, ++hentbuf)
|
for (i = count - 1; i >= 0; --i, ++hentbuf)
|
||||||
{
|
{
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
char buf [4];
|
char buf [8];
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
const CGEN_INSN *insn = &insns[i];
|
const CGEN_INSN *insn = &insns[i];
|
||||||
|
size_t size;
|
||||||
|
|
||||||
if (! (* cd->dis_hash_p) (insn))
|
if (! (* cd->dis_hash_p) (insn))
|
||||||
continue;
|
continue;
|
||||||
|
@ -121,10 +123,9 @@ hash_insn_array (CGEN_CPU_DESC cd,
|
||||||
to hash on, so set both up. */
|
to hash on, so set both up. */
|
||||||
|
|
||||||
value = CGEN_INSN_BASE_VALUE (insn);
|
value = CGEN_INSN_BASE_VALUE (insn);
|
||||||
bfd_put_bits ((bfd_vma) value,
|
size = CGEN_INSN_MASK_BITSIZE (insn);
|
||||||
buf,
|
OPCODES_ASSERT (size <= sizeof (buf) * 8);
|
||||||
CGEN_INSN_MASK_BITSIZE (insn),
|
bfd_put_bits ((bfd_vma) value, buf, size, big_p);
|
||||||
big_p);
|
|
||||||
hash = (* cd->dis_hash) (buf, value);
|
hash = (* cd->dis_hash) (buf, value);
|
||||||
add_insn_to_hash_chain (hentbuf, insn, htable, hash);
|
add_insn_to_hash_chain (hentbuf, insn, htable, hash);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue