PR26460 UBSAN: tc-ia64.c:6107 index out of bounds

Alan Modra amodra@gmail.com
Fri Aug 28 13:44:41 GMT 2020


	PR 26460
	* config/tc-ia64.c (parse_operands): Don't access past end of
	idesc->operands.

diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index f827e459df..0e60416f1b 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -6098,8 +6098,10 @@ parse_operands (struct ia64_opcode *idesc)
     {
       if (i < NELEMS (CURR_SLOT.opnd))
 	{
-	  sep = parse_operand_maybe_eval (CURR_SLOT.opnd + i, '=',
-					  idesc->operands[i]);
+	  enum ia64_opnd op = IA64_OPND_NIL;
+	  if (i < NELEMS (idesc->operands))
+	    op = idesc->operands[i];
+	  sep = parse_operand_maybe_eval (CURR_SLOT.opnd + i, '=', op);
 	  if (CURR_SLOT.opnd[i].X_op == O_absent)
 	    break;
 	}

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list