From f405494f214315091fb0864827b07b5e6f12ee84 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Thu, 2 Jul 2020 13:53:07 +0100 Subject: aarch64: Fix segfault on unicode symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes a segfault which occurs when the AArch64 backend parses a symbol operand that begins with a register name and ends with a unicode byte (byte value > 127). For example, the following input causes the crash: x0é: udf x0é gas/ChangeLog: 2020-07-02 Alex Coplan * config/tc-aarch64.c (reg_name_p): Fix cast so that we don't segfault on negative chars. * testsuite/gas/aarch64/reglike-label-unicode-segv.d: New test. * testsuite/gas/aarch64/reglike-label-unicode-segv.s: Input. --- gas/config/tc-aarch64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gas/config') diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 728fd10..ecb15d2 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -2190,7 +2190,7 @@ reg_name_p (char *str, aarch64_reg_type reg_type) return FALSE; skip_whitespace (str); - if (*str == ',' || is_end_of_line[(unsigned int) *str]) + if (*str == ',' || is_end_of_line[(unsigned char) *str]) return TRUE; return FALSE; -- cgit v1.1