Fix: Use of uninitialized memory
authorJacob Navia <jacob@jacob.remcomp.fr>
Mon, 18 Sep 2023 11:03:58 +0000 (12:03 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 18 Sep 2023 11:03:58 +0000 (12:03 +0100)
  * config/tc-riscv.c (riscv_ip_hardcode): Fully initialise the allocated riscv_opcode structure.

gas/ChangeLog
gas/config/tc-riscv.c

index 3339c4cadd3d95410961a18544aacc0f3d25b49a..c6e730f5dcd563d2698f33fdf0546b797f3b22f3 100644 (file)
@@ -1,3 +1,8 @@
+2023-09-18  Jacob Navia  <jacob@jacob.remcomp.fr>
+
+       * config/tc-riscv.c (riscv_ip_hardcode): Fully initialise the
+       allocated riscv_opcode structure.
+
 2023-08-17  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
        * config/tc-bpf.c (check_immediate_overflow): New function.
index cf6e0d8b01502cdf625cc3f13133cc8ff37be667..3b520ad208b2f6760930b9b33819c086532698f3 100644 (file)
@@ -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);