From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7990 invoked by alias); 23 Feb 2004 15:13:47 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7983 invoked from network); 23 Feb 2004 15:13:46 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 23 Feb 2004 15:13:46 -0000 Received: by localhost.redhat.com (Postfix, from userid 469) id 765D01A448A; Mon, 23 Feb 2004 10:09:09 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16442.6037.378665.429220@localhost.redhat.com> Date: Mon, 23 Feb 2004 15:13:00 -0000 To: Eli Zaretskii Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Fix a crash in coffread.c (Was: GDB 6.1 branch 2004-02-26-gmt) In-Reply-To: <3099-Sun22Feb2004230710+0200-eliz@elta.co.il> References: <20040220011823.848FD4B104@berman.michael-chastain.com> <9791-Sat21Feb2004181440+0200-eliz@elta.co.il> <3099-Sun22Feb2004230710+0200-eliz@elta.co.il> X-SW-Source: 2004-02/txt/msg00634.txt.bz2 Eli Zaretskii writes: > > Date: Sat, 21 Feb 2004 18:14:41 +0200 > > From: "Eli Zaretskii" > > > > I built today the latest snapshot of CVS HEAD and found a new > > regression: the DJGPP port crashes at startup while debugging itself. > > Bug squashed, I think. It turned out to be a very old one, actually; > the current CVS HEAD didn't introduce it, it just exposed it because > the GDB binary is now so large. > > The bug happens only when GDB (or any other large program) is compiled > with COFF debug info and the line table overflows the 64K limit > allowed by COFF debug info. I think the patch below fixes that. > > Okay to commit? > > 2004-02-22 Eli Zaretskii > > * coffread.c (enter_linenos): Don't let rawptr reference memory > outside linetab[]'s limits. > > > --- gdb/coffread.c~0 2004-02-14 17:46:32.000000000 +0200 > +++ gdb/coffread.c 2004-02-22 22:42:34.000000000 +0200 > @@ -1362,11 +1362,15 @@ enter_linenos (long file_offset, int fir > /* line numbers start at one for the first line of the function */ > first_line--; > > - for (;;) > + /* If the line number is full (e.g. 64K lines in COFF debug info), ^^^^^^^^ table? > + the next function's L_LNNO32 might not be zero, so don't overstep > + the table's end in any case. */ > + for ( ; rawptr <= &linetab[0] + linetab_size; ) how about a while loop? I am not sure I understand how the two cases differ in the layout of the debug info. Is the beginning of a function still zero valued? Do we have a function with >64k lines? If we are running beyond the end of the table, does this mean that we don't read all the debug info we have? elena