PR26481 UBSAN: tc-pj.c:281 index out of bounds

PR 26481
	* config/tc-pj.c (md_assemble): Don't loop past end of
	opcode->arg array.
This commit is contained in:
Alan Modra 2020-08-29 10:46:59 +09:30
parent 736c9875c0
commit 8a267ea847
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2020-08-29 Alan Modra <amodra@gmail.com>
PR 26481
* config/tc-pj.c (md_assemble): Don't loop past end of
opcode->arg array.
2020-08-28 Alan Modra <amodra@gmail.com>
PR 26460

View File

@ -270,7 +270,7 @@ md_assemble (char *str)
}
else
{
int an;
unsigned int an;
output = frag_more (opcode->len);
output[idx++] = opcode->opcode;
@ -278,7 +278,7 @@ md_assemble (char *str)
if (opcode->opcode_next != -1)
output[idx++] = opcode->opcode_next;
for (an = 0; opcode->arg[an]; an++)
for (an = 0; an < ARRAY_SIZE (opcode->arg) && opcode->arg[an]; an++)
{
expressionS arg;