ubsan: crx: index 5 out of bounds for type 'operand_desc const[5]'

* crx-dis.c (get_number_of_operands): Don't access operands[]
	out of bounds.
This commit is contained in:
Alan Modra 2019-12-26 16:04:20 +10:30
parent 6c2ca6c25d
commit 100b122fc1
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2019-12-26 Alan Modra <amodra@gmail.com>
* crx-dis.c (get_number_of_operands): Don't access operands[]
out of bounds.
2019-12-26 Alan Modra <amodra@gmail.com>
* v850-dis.c (disassemble): Avoid signed overflow. Don't use

View File

@ -105,7 +105,7 @@ get_number_of_operands (void)
{
int i;
for (i = 0; instruction->operands[i].op_type && i < MAX_OPERANDS; i++)
for (i = 0; i < MAX_OPERANDS && instruction->operands[i].op_type; i++)
;
return i;