Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: msnyder@sonic.net
To: gdb-patches@sourceware.org, binutils@sourceware.org
Subject: [PATCH] opcodes/i386-dis.c, print_insn, null ptr.
Date: Wed, 01 Aug 2007 21:15:00 -0000	[thread overview]
Message-ID: <6845.12.7.175.2.1186002936.squirrel@webmail.sonic.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

If we come to this point via the default case in the switch
statement above, we will not have updated 'dp' and dp->name
will still be null.  Then putop will dereference it.


[-- Attachment #2: 19b.txt --]
[-- Type: text/plain, Size: 1092 bytes --]

2007-08-01  Michael Snyder  <msnyder@access-company.com>

	* i386-dis.c (print_insn): Guard against NULL.

Index: i386-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/i386-dis.c,v
retrieving revision 1.131
diff -p -6 -r1.131 i386-dis.c
*** i386-dis.c	29 Jul 2007 19:43:36 -0000	1.131
--- i386-dis.c	1 Aug 2007 21:11:02 -0000
*************** print_insn (bfd_vma pc, disassemble_info
*** 3779,3791 ****
  	    default:
  	      oappend (INTERNAL_DISASSEMBLER_ERROR);
  	      break;
  	    }
  	}
  
!       if (putop (dp->name, sizeflag) == 0)
          {
  	  for (i = 0; i < MAX_OPERANDS; ++i)
  	    {
  	      obufp = op_out[i];
  	      op_ad = MAX_OPERANDS - 1 - i;
  	      if (dp->op[i].rtn)
--- 3779,3791 ----
  	    default:
  	      oappend (INTERNAL_DISASSEMBLER_ERROR);
  	      break;
  	    }
  	}
  
!       if (dp->name != NULL && putop (dp->name, sizeflag) == 0)
          {
  	  for (i = 0; i < MAX_OPERANDS; ++i)
  	    {
  	      obufp = op_out[i];
  	      op_ad = MAX_OPERANDS - 1 - i;
  	      if (dp->op[i].rtn)

             reply	other threads:[~2007-08-01 21:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-01 21:15 msnyder [this message]
2007-08-01 22:00 ` H.J. Lu
2007-08-02  0:40   ` msnyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6845.12.7.175.2.1186002936.squirrel@webmail.sonic.net \
    --to=msnyder@sonic.net \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox