aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-28 23:09:29 +0930
committerAlan Modra <amodra@gmail.com>2020-08-28 23:15:21 +0930
commited2ed4dcf4ae20b9a7c38ffdf379fef383c6b8f9 (patch)
treedd235290b046f6b8a2011cdc80936591df16da75
parent07319accdf8eecc5111b343802dadd067f683d26 (diff)
downloadgdb-ed2ed4dcf4ae20b9a7c38ffdf379fef383c6b8f9.zip
gdb-ed2ed4dcf4ae20b9a7c38ffdf379fef383c6b8f9.tar.gz
gdb-ed2ed4dcf4ae20b9a7c38ffdf379fef383c6b8f9.tar.bz2
PR26460 UBSAN: tc-ia64.c:6107 index out of bounds
PR 26460 * config/tc-ia64.c (parse_operands): Don't access past end of idesc->operands.
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-ia64.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 63d1596..9bdbb4b 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index f827e45..0e60416 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;
}