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

Jan Beulich jbeulich@sourceware.org
Fri Apr 17 06:07:49 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=19bcbe810d8c49eb05324624c0af72091d38c4a7

commit 19bcbe810d8c49eb05324624c0af72091d38c4a7
Author: Jan Beulich <jbeulich@suse.com>
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


More information about the Binutils-cvs mailing list