Segmentation fault i386-gen
authorAlan Modra <amodra@gmail.com>
Tue, 26 Jan 2021 01:50:23 +0000 (12:20 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 26 Jan 2021 10:24:43 +0000 (20:54 +1030)
A case of inst->next being uninitialised.

* i386-gen.c (parse_template): Ensure entire template_instance
is initialised.

opcodes/ChangeLog
opcodes/i386-gen.c

index 57240f118738a8b08c0041e08aa2ca5b2af431c2..ecbf005e991456f63428b407b821f9f060b9ca2b 100644 (file)
@@ -1,3 +1,8 @@
+2021-01-26  Alan Modra  <amodra@gmail.com>
+
+       * i386-gen.c (parse_template): Ensure entire template_instance
+       is initialised.
+
 2021-01-15  Nelson Chu  <nelson.chu@sifive.com>
 
        * riscv-opc.c (riscv_gpr_names_abi): Aligned the code.
index b3c87dbbd662ef29dfb1bdca1456a26f09c944bb..44cdc66198595bbc1790af1c922c5870d0dd912e 100644 (file)
@@ -1576,6 +1576,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);