PR26460 UBSAN: tc-ia64.c:6107 index out of bounds
authorAlan Modra <amodra@gmail.com>
Fri, 28 Aug 2020 13:39:29 +0000 (23:09 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 28 Aug 2020 13:45:21 +0000 (23:15 +0930)
PR 26460
* config/tc-ia64.c (parse_operands): Don't access past end of
idesc->operands.

gas/ChangeLog
gas/config/tc-ia64.c

index 63d1596eba430ad8e0f6840f2df114e0deffdbdc..9bdbb4b172f3fda855cf48e70e593f3102409884 100644 (file)
@@ -1,3 +1,9 @@
+2020-08-28  Alan Modra  <amodra@gmail.com>
+
+       PR 26460
+       * config/tc-ia64.c (parse_operands): Don't access past end of
+       idesc->operands.
+
 2020-08-26  Mark Wielaard  <mark@klomp.org>
 
        * as.c (parse_args): Handle bad -gdwarf options.
index f827e459df2eb970ee8f4d371787a7647444b6f8..0e60416f1b231e819ba3434a89c7eda770111cfa 100644 (file)
@@ -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;
        }