aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-01-26 12:20:23 +1030
committerAlan Modra <amodra@gmail.com>2021-01-27 08:57:01 +1030
commit6dcfc42f6893f4e49cb8d8e9fe1bfedcb783bb20 (patch)
tree43297b23adf118661569362af3348f3a95e8a3ef
parentb1e65c1026ab07203367a099b2d3b29efb3e0ba1 (diff)
downloadfsf-binutils-gdb-6dcfc42f6893f4e49cb8d8e9fe1bfedcb783bb20.zip
fsf-binutils-gdb-6dcfc42f6893f4e49cb8d8e9fe1bfedcb783bb20.tar.gz
fsf-binutils-gdb-6dcfc42f6893f4e49cb8d8e9fe1bfedcb783bb20.tar.bz2
Segmentation fault i386-gen
A case of inst->next being uninitialised. * i386-gen.c (parse_template): Ensure entire template_instance is initialised. (cherry picked from commit c3ffb8f340f567949f24c3bab62259f0e593637f)
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/i386-gen.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index fada4f8..ced84d6 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2021-01-26 Alan Modra <amodra@gmail.com>
+
+ * i386-gen.c (parse_template): Ensure entire template_instance
+ is initialised.
+
2020-10-07 H.J. Lu <hongjiu.lu@intel.com>
PR gas/26685
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 7230f8734..09615f6 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -1465,6 +1465,8 @@ parse_template (char *buf, int lineno)
*end++ = '\0';
inst = xmalloc (sizeof (*inst));
+ inst->next = NULL;
+ inst->args = NULL;
cur = next_field (buf, ':', &next, end);
inst->name = xstrdup (cur);