[PATCH 2/2] gdb/riscv: Fix buffer overflow on riscv_insn::fetch_instruction
Tsukasa OI
research_trasio@irq.a4lg.com
Tue Oct 4 08:59:08 GMT 2022
Because riscv_insn_length started to support instructions up to 176-bit,
we need to increase packet buffer size to 176-bit in size.
Note that this change will make the result of riscv_insn::fetch_instruction
partial when the instruction is longer than 64-bits. To really support
instructions longer than 64-bit, we need something more.
---
gdb/riscv-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 47d8f9e601b..99307bd2de1 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1770,7 +1770,7 @@ riscv_insn::fetch_instruction (struct gdbarch *gdbarch,
CORE_ADDR addr, int *len)
{
enum bfd_endian byte_order = gdbarch_byte_order_for_code (gdbarch);
- gdb_byte buf[8];
+ gdb_byte buf[22];
int instlen, status;
/* All insns are at least 16 bits. */
--
2.34.1
More information about the Binutils
mailing list