From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18210 invoked by alias); 2 Mar 2011 18:09:55 -0000 Received: (qmail 18199 invoked by uid 22791); 2 Mar 2011 18:09:54 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Mar 2011 18:09:48 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id A3CFE41006; Wed, 2 Mar 2011 10:09:47 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost4.vmware.com (Postfix) with ESMTP id 99E76C9ED3; Wed, 2 Mar 2011 10:09:47 -0800 (PST) Message-ID: <4D6E87EB.4030009@vmware.com> Date: Wed, 02 Mar 2011 18:09:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: Joel Brobecker CC: "gdb-patches@sourceware.org" Subject: Re: [commit] record.c (record_restore): Check pointer before use. References: <4D6D564A.8080403@vmware.com> <20110302042646.GL30306@adacore.com> In-Reply-To: <20110302042646.GL30306@adacore.com> Content-Type: multipart/mixed; boundary="------------040602000508040104070505" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00113.txt.bz2 This is a multi-part message in MIME format. --------------040602000508040104070505 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1004 Joel Brobecker wrote: >> 2011-03-01 Michael Snyder >> >> * 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? --------------040602000508040104070505 Content-Type: text/plain; name="reversenull1.5.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="reversenull1.5.txt" Content-length: 930 2011-03-02 Michael Snyder * 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)); --------------040602000508040104070505--