aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Navia <jacob@jacob.remcomp.fr>2023-09-18 12:03:58 +0100
committerNick Clifton <nickc@redhat.com>2023-09-18 12:03:58 +0100
commitcf2ab5ef0b716dea512d85276c484fce758fa5d4 (patch)
treed3cce4d5fb36cfda770372a3b00ef01985e858c9
parentcb2775070260eae210df62ab57df95927a89536e (diff)
downloadbinutils-cf2ab5ef0b716dea512d85276c484fce758fa5d4.zip
binutils-cf2ab5ef0b716dea512d85276c484fce758fa5d4.tar.gz
binutils-cf2ab5ef0b716dea512d85276c484fce758fa5d4.tar.bz2
Fix: Use of uninitialized memory
* config/tc-riscv.c (riscv_ip_hardcode): Fully initialise the allocated riscv_opcode structure.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-riscv.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3339c4c..c6e730f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index cf6e0d8b..3b520ad 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);