aarch64: Fix segfault on unicode symbols

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  <alex.coplan@arm.com>

	* 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.
This commit is contained in:
Alex Coplan 2020-07-02 13:53:07 +01:00
parent b1a35af270
commit f405494f21
4 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2020-07-02 Alex Coplan <alex.coplan@arm.com>
* 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.
2020-07-02 Nick Clifton <nickc@redhat.com>
PR 26028

View File

@ -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;

View File

@ -0,0 +1,8 @@
#objdump: -dr
.*: file format .*
Disassembly of section \.text:
0+ <x0é>:
.*: 00000000 udf #0

View File

@ -0,0 +1,2 @@
x0é:
udf x0é