aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-09-08 08:45:11 +0200
committerJan Beulich <jbeulich@suse.com>2023-09-08 08:45:11 +0200
commit1adecddd190f8eca8ea153dec2b003985bcc744d (patch)
tree2c0cf8848cafcbba29a911cddf91e4495342bf13 /gas
parent3c11aea0297a3f038e552eee424c214dc5a2c4bc (diff)
downloadbinutils-1adecddd190f8eca8ea153dec2b003985bcc744d.zip
binutils-1adecddd190f8eca8ea153dec2b003985bcc744d.tar.gz
binutils-1adecddd190f8eca8ea153dec2b003985bcc744d.tar.bz2
x86: restrict prefix use with .insn VEX/XOP/EVEX
Avoid triggering the respective abort() in output_insn().
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-i386.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 00abfc7..ecf886c 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -10806,6 +10806,29 @@ s_insn (int dummy ATTRIBUTE_UNUSED)
if (line > end && i.vec_encoding == vex_encoding_default)
i.vec_encoding = evex ? vex_encoding_evex : vex_encoding_vex;
+ if (i.vec_encoding != vex_encoding_default)
+ {
+ /* Only address size and segment override prefixes are permitted with
+ VEX/XOP/EVEX encodings. */
+ const unsigned char *p = i.prefix;
+
+ for (j = 0; j < ARRAY_SIZE (i.prefix); ++j, ++p)
+ {
+ if (!*p)
+ continue;
+
+ switch (j)
+ {
+ case SEG_PREFIX:
+ case ADDR_PREFIX:
+ break;
+ default:
+ as_bad (_("illegal prefix used with VEX/XOP/EVEX"));
+ goto bad;
+ }
+ }
+ }
+
if (line > end && *line == '.')
{
/* Length specifier (VEX.L, XOP.L, EVEX.L'L). */