https://sourceware.org/bugzilla/show_bug.cgi?id=24308

            Bug ID: 24308
           Summary: Check the value of var mnem_p before accessing
           Product: binutils
           Version: 2.33 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: li.hao296 at zte dot com.cn
  Target Milestone: ---

gas/config/tc-i386.c:
In the following code fragment of the parse_insn function, the value of mnem_p
should be checked before accessing.

   if (!current_templates)
    {
 check_suffix:
      /* See if we can get a match by trimming off a suffix.  */
      switch (mnem_p[-1]) // need to check whether the value of mem_p and
mnemonic 
                          // are equal


here is the patch:

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index d31ee6a..8d4657f
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4560,6 +4560,7 @@ parse_insn (char *line, char *mnemonic)

   if (!current_templates)
     {
+      if (mnem_p != mnemonic)
 check_suffix:
       /* See if we can get a match by trimming off a suffix.  */
       switch (mnem_p[-1])

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to