This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/2] RISC-V: Fix use-after free bug
- From: Palmer Dabbelt <palmer at dabbelt dot com>
- To: binutils at sourceware dot org, klauskpedersen at rdamicro dot com
- Cc: patches at groups dot riscv dot org, Andrew Waterman <andrew at sifive dot com>
- Date: Thu, 27 Jul 2017 08:44:15 -0700
- Subject: [PATCH 1/2] RISC-V: Fix use-after free bug
- Authentication-results: sourceware.org; auth=none
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