[binutils-gdb] x86/AT&T: properly reject effectively absent memory operands

Jan Beulich via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=19bcbe810d8c49eb05324624c0af72091d38c4a7

commit 19bcbe810d8c49eb05324624c0af72091d38c4a7
Author: Jan Beulich <[email protected]>
Date:   Fri Apr 17 08:06:55 2026 +0200

    x86/AT&T: properly reject effectively absent memory operands
    
    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.

Diff:
---
 gas/config/tc-i386.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index fb77f43126b..5ce83b0ac71 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -15437,7 +15437,7 @@ static INLINE bool starts_memory_operand (char c)
 {
   return ISDIGIT (c)
 	 || is_name_beginner (c)
-	 || strchr ("([\"+-!~", c);
+	 || (c && strchr ("([\"+-!~", c));
 }
 
 /* Parse OPERAND_STRING into the i386_insn structure I.  Returns zero
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.