[PATCH 1/2] RISC-V: Fix use-after free bug
Palmer Dabbelt
palmer@dabbelt.com
Thu Jul 27 15:45:00 GMT 2017
From: Andrew Waterman <andrew@sifive.com>
bfd/ChangeLog
2017-07-25 Andrew Waterman <andrew@sifive.com>
* config/tc-riscv.c (riscv_set_arch): Obviate use-after-free.
---
gas/config/tc-riscv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 9843675ee3..8bf0db5e78 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -200,7 +200,6 @@ riscv_set_arch (const char *s)
extension = subset;
riscv_add_subset (subset);
p += strlen (subset);
- free (subset);
}
else if (*p == '_')
p++;
@@ -220,6 +219,8 @@ riscv_set_arch (const char *s)
else
as_fatal ("-march=%s: unsupported ISA subset `%c'", s, *p);
}
+
+ free (extension);
}
/* Handle of the OPCODE hash table. */
--
2.13.0
More information about the Binutils
mailing list