* [commit] record.c (record_restore): Check pointer before use.
@ 2011-03-01 20:25 Michael Snyder
2011-03-02 4:27 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2011-03-01 20:25 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 13 bytes --]
checked in.
[-- Attachment #2: reversenull1.txt --]
[-- Type: text/plain, Size: 894 bytes --]
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;
if (record_debug)
fprintf_unfiltered (gdb_stdlog, "%s", bfd_section_name (core_bfd, osec));
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] record.c (record_restore): Check pointer before use.
2011-03-01 20:25 [commit] record.c (record_restore): Check pointer before use Michael Snyder
@ 2011-03-02 4:27 ` Joel Brobecker
2011-03-02 18:09 ` Michael Snyder
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2011-03-02 4:27 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
> 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.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] record.c (record_restore): Check pointer before use.
2011-03-02 4:27 ` Joel Brobecker
@ 2011-03-02 18:09 ` Michael Snyder
2011-03-02 19:33 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2011-03-02 18:09 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]
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?
[-- Attachment #2: reversenull1.5.txt --]
[-- Type: text/plain, Size: 930 bytes --]
2011-03-02 Michael Snyder <msnyder@vmware.com>
* record.c (record_restore): Move printf to before error return.
Index: record.c
===================================================================
RCS file: /cvs/src/src/gdb/record.c,v
retrieving revision 1.58
diff -u -p -u -p -r1.58 record.c
--- record.c 1 Mar 2011 20:24:48 -0000 1.58
+++ record.c 2 Mar 2011 18:05:54 -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;
+ osec_size = bfd_section_size (core_bfd, osec);
if (record_debug)
fprintf_unfiltered (gdb_stdlog, "%s", bfd_section_name (core_bfd, osec));
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] record.c (record_restore): Check pointer before use.
2011-03-02 18:09 ` Michael Snyder
@ 2011-03-02 19:33 ` Joel Brobecker
0 siblings, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2011-03-02 19:33 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
> 2011-03-02 Michael Snyder <msnyder@vmware.com>
>
> * record.c (record_restore): Move printf to before error return.
Looks right to me.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-02 19:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 20:25 [commit] record.c (record_restore): Check pointer before use Michael Snyder
2011-03-02 4:27 ` Joel Brobecker
2011-03-02 18:09 ` Michael Snyder
2011-03-02 19:33 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox