]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
x86: Check for more than 2 memory references
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 27 Jul 2018 13:35:09 +0000 (06:35 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 27 Jul 2018 13:35:09 +0000 (06:35 -0700)
commit1286ab788188bb8f0b0da2a3def4641fb3817f10
tree8700112aeac564d48acfb5a97bf27785211964b7
parent469d3b57cef3d9e02d4bc584a9cc814ef22cdb4e
x86: Check for more than 2 memory references

For

movsd (%esi), %ss:(%edi), %ss:(%eax)

we got

[hjl@gnu-tools-1 tmp]$ as -o x.o x.s
x.s: Assembler messages:
x.s:1: Error: too many memory references for `movsd'
munmap_chunk(): invalid pointer
x.s:1: Internal error (Aborted).
Please report this bug.
[hjl@gnu-tools-1 tmp]$

struct _i386_insn has

const seg_entry *seg[2];

3 memory references will overflow the seg array.  We should issue an
error if there are more than 2 memory references.

PR gas/23453
* config/tc-i386.c (parse_operands): Check for more than 2
memory references.
* testsuite/gas/i386/inval.s: Add a movsd test with 3 memory
references.
* testsuite/gas/i386/x86-64-inval.s: Likewise.
* testsuite/gas/i386/inval.l: Updated.
* testsuite/gas/i386/x86-64-inval.l: Likewise.
gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/gas/i386/inval.l
gas/testsuite/gas/i386/inval.s
gas/testsuite/gas/i386/x86-64-inval.l
gas/testsuite/gas/i386/x86-64-inval.s