From cf2ab5ef0b716dea512d85276c484fce758fa5d4 Mon Sep 17 00:00:00 2001 From: Jacob Navia Date: Mon, 18 Sep 2023 12:03:58 +0100 Subject: [PATCH] Fix: Use of uninitialized memory * config/tc-riscv.c (riscv_ip_hardcode): Fully initialise the allocated riscv_opcode structure. --- gas/ChangeLog | 5 +++++ gas/config/tc-riscv.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 3339c4cadd3..c6e730f5dcd 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2023-09-18 Jacob Navia + + * config/tc-riscv.c (riscv_ip_hardcode): Fully initialise the + allocated riscv_opcode structure. + 2023-08-17 Jose E. Marchesi * config/tc-bpf.c (check_immediate_overflow): New function. diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index cf6e0d8b015..3b520ad208b 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -3718,7 +3718,7 @@ riscv_ip_hardcode (char *str, if (*input_line_pointer != '\0') return _("unrecognized values"); - insn = XNEW (struct riscv_opcode); + insn = XCNEW (struct riscv_opcode); insn->match = values[num - 1]; create_insn (ip, insn); unsigned int bytes = riscv_insn_length (insn->match); -- 2.30.2