From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13355 invoked by alias); 21 Mar 2013 15:31:04 -0000 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 Received: (qmail 13320 invoked by uid 89); 21 Mar 2013 15:30:53 -0000 X-Spam-SWARE-Status: No, score=-8.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 21 Mar 2013 15:30:51 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2LFUopI017962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Mar 2013 11:30:50 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2LFUm6q029934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 21 Mar 2013 11:30:49 -0400 From: Tom Tromey To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: RFC: fix latent bug in syms_from_objfile_1 References: <87ip4m7wxy.fsf@fleche.redhat.com> <20130320184034.GA708@host2.jankratochvil.net> <87ip4l7swd.fsf@fleche.redhat.com> <20130321141954.GA10644@host2.jankratochvil.net> Date: Thu, 21 Mar 2013 15:36:00 -0000 In-Reply-To: <20130321141954.GA10644@host2.jankratochvil.net> (Jan Kratochvil's message of "Thu, 21 Mar 2013 15:19:54 +0100") Message-ID: <871ub84vo7.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-03/txt/msg00789.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> On Wed, 20 Mar 2013 20:50:10 +0100, Tom Tromey wrote: >> --- a/gdb/symfile.c >> +++ b/gdb/symfile.c Jan> [...] >> @@ -205,11 +207,14 @@ alloc_section_addr_info (size_t num_sections) >> struct section_addr_info *sap; >> size_t size; >> >> + /* Make sure the size calculation turns out ok. */ >> + if (num_sections == 0) >> + ++num_sections; Jan> I always thought such sizeof calculation works even with # of Jan> elements == 0. Why not? It seemed weird to me since it would allocate an object smaller than a struct section_addr_info. I don't mind dropping that line though. Jan> I am OK with the patch, thanks for the cleanup waiting for so many years. Thanks. I'm going to put it in today, since it is actively messing up my regression tests. Tom