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

Message ID a4dad5f7-380d-4fc4-9f0f-6cae96b85fdf@suse.com
State New
Headers
Series x86: gas insn operand processing |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed

Commit Message

Jan Beulich April 9, 2026, 6:48 a.m. UTC
  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").
  

Patch

--- 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