[PATCH 2/2] x86/AT&T: properly reject effectively absent memory operands

Jan Beulich jbeulich@suse.com
Thu Apr 9 06:48:11 GMT 2026


A segment override or * followed by nothing is not a valid operand, yet
is regarded as one due to strchr() succeeding when passed nul as 2nd
argument.
---
I fear it was me who had introduced this issue, in 014fbcda4c66 ("x86:
allow unary operators to start a memory operand").

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -15422,7 +15422,7 @@ static INLINE bool starts_memory_operand
 {
   return ISDIGIT (c)
 	 || is_name_beginner (c)
-	 || strchr ("([\"+-!~", c);
+	 || (c && strchr ("([\"+-!~", c));
 }
 
 /* Parse OPERAND_STRING into the i386_insn structure I.  Returns zero



More information about the Binutils mailing list