aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-05-14 12:42:02 +0100
committerNick Clifton <nickc@redhat.com>2019-05-14 12:42:02 +0100
commit35015cd193be5e603ed31c14472d2d9d17e14e7a (patch)
tree33e9f0b6e6046018a72fc685b3ad787c7ce9713c /gas
parent37d0d09177dc02e0002ab8b90d9b7bc402af9240 (diff)
downloadgdb-35015cd193be5e603ed31c14472d2d9d17e14e7a.zip
gdb-35015cd193be5e603ed31c14472d2d9d17e14e7a.tar.gz
gdb-35015cd193be5e603ed31c14472d2d9d17e14e7a.tar.bz2
Fix illegal memory access triggered when attempting to assemble a bogus i386 source file.
PR 24538 * config/tc-i386-intel.c (i386_intel_simplify_register): Reject illegal register numbers.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-i386-intel.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 57be175..1530ebf 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-14 Nick Clifton <nickc@redhat.com>
+
+ PR 24538
+ * config/tc-i386-intel.c (i386_intel_simplify_register): Reject
+ illegal register numbers.
+
2019-05-10 Nick Clifton <nickc@redhat.com>
PR 24538
diff --git a/gas/config/tc-i386-intel.c b/gas/config/tc-i386-intel.c
index a12886d..a2cd286 100644
--- a/gas/config/tc-i386-intel.c
+++ b/gas/config/tc-i386-intel.c
@@ -270,6 +270,12 @@ i386_intel_simplify_register (expressionS *e)
else
reg_num = e->X_md - 1;
+ if (reg_num < 0 || reg_num >= (int) i386_regtab_size)
+ {
+ as_bad (_("invalid register number"));
+ return 0;
+ }
+
if (!intel_state.in_bracket)
{
if (i.op[this_operand].regs)