[commit] record.c (record_restore): Check pointer before use.

Michael Snyder msnyder@vmware.com
Wed Mar 2 18:09:00 GMT 2011


Joel Brobecker wrote:
>> 2011-03-01  Michael Snyder  <msnyder@vmware.com>
>>
>> 	* reverse.c (record_restore): Move null-check to before pointer
>> 	dereference.
>>
>> Index: record.c
>> ===================================================================
>> RCS file: /cvs/src/src/gdb/record.c,v
>> retrieving revision 1.57
>> diff -u -p -u -p -r1.57 record.c
>> --- record.c	10 Jan 2011 20:38:50 -0000	1.57
>> +++ record.c	1 Mar 2011 20:23:33 -0000
>> @@ -2214,12 +2214,12 @@ record_restore (void)
>>  
>>    /* Now need to find our special note section.  */
>>    osec = bfd_get_section_by_name (core_bfd, "null0");
>> +  if (osec == NULL)
>> +    return;
>>    osec_size = bfd_section_size (core_bfd, osec);
>>    if (record_debug)
>>      fprintf_unfiltered (gdb_stdlog, "Find precord section %s.\n",
>>  			osec ? "succeeded" : "failed");
>> -  if (osec == NULL)
>> -    return;
> 
> I think that the debug trace ("Find precord section...") also
> needs to be moved up.
> 

Ah - right.  Like this?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: reversenull1.5.txt
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20110302/f469ac43/attachment.txt>


More information about the Gdb-patches mailing list