public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] opcodes/i386-dis.c, print_insn, null ptr.
@ 2007-08-01 21:15 msnyder
  2007-08-01 22:00 ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: msnyder @ 2007-08-01 21:15 UTC (permalink / raw)
  To: gdb-patches, binutils

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] opcodes/i386-dis.c, print_insn, null ptr.
  2007-08-01 21:15 [PATCH] opcodes/i386-dis.c, print_insn, null ptr msnyder
@ 2007-08-01 22:00 ` H.J. Lu
  2007-08-02  0:40   ` msnyder
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2007-08-01 22:00 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches, binutils

On Wed, Aug 01, 2007 at 02:15:36PM -0700, msnyder@sonic.net wrote:
> 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.
> 

> 2007-08-01  Michael Snyder  <msnyder@access-company.com>
> 
> 	* i386-dis.c (print_insn): Guard against NULL.
> 

It is OK.

Thanks.


H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] opcodes/i386-dis.c, print_insn, null ptr.
  2007-08-01 22:00 ` H.J. Lu
@ 2007-08-02  0:40   ` msnyder
  0 siblings, 0 replies; 3+ messages in thread
From: msnyder @ 2007-08-02  0:40 UTC (permalink / raw)
  To: H.J. Lu; +Cc: msnyder, gdb-patches, binutils

> On Wed, Aug 01, 2007 at 02:15:36PM -0700, msnyder@sonic.net wrote:
>> 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.
>>
>
>> 2007-08-01  Michael Snyder  <msnyder@access-company.com>
>>
>> 	* i386-dis.c (print_insn): Guard against NULL.
>>
>
> It is OK.

Committed, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-02  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-01 21:15 [PATCH] opcodes/i386-dis.c, print_insn, null ptr msnyder
2007-08-01 22:00 ` H.J. Lu
2007-08-02  0:40   ` msnyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).