From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14210 invoked by alias); 19 Jan 2004 18:39:37 -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 14140 invoked from network); 19 Jan 2004 18:39:35 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 19 Jan 2004 18:39:35 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i0JId45e000270; Mon, 19 Jan 2004 19:39:04 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i0JId32Y000530; Mon, 19 Jan 2004 19:39:03 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i0JId3oh000527; Mon, 19 Jan 2004 19:39:03 +0100 (CET) Date: Mon, 19 Jan 2004 18:39:00 -0000 Message-Id: <200401191839.i0JId3oh000527@elgar.kettenis.dyndns.org> From: Mark Kettenis To: drow@mvista.com CC: gdb-patches@sources.redhat.com In-reply-to: <20040118225254.GA8516@nevyn.them.org> (message from Daniel Jacobowitz on Sun, 18 Jan 2004 17:52:54 -0500) Subject: Re: [PATCH/RFC] Reorganize osabi.c:generic_elf_osabi_sniff_abi_tag_sections() References: <200401182040.i0IKeeMu008703@elgar.kettenis.dyndns.org> <20040118225254.GA8516@nevyn.them.org> X-SW-Source: 2004-01/txt/msg00513.txt.bz2 Date: Sun, 18 Jan 2004 17:52:54 -0500 From: Daniel Jacobowitz On Sun, Jan 18, 2004 at 09:40:40PM +0100, Mark Kettenis wrote: > + /* ...and check it. */ > + gdb_assert (notesz <= MAX_NOTESZ); > + if (notesz > bfd_section_size (abfd, sect)) > + return 0; I'd rather not add assertions based on the input file. Can we complain and fail instead? Ah, but the assert is an internal consistency check. It checks whether the MAX_NOTESZ limit is large enough for the note the caller of check_note() is checking for. Basically the assert triggers if someone adds a check_note() call with a long name, or a large descriptor size. In that case the person in question should increase MAX_NOTESZ. The assert is guaranteed not to be triggered for the check_note() calls in my patch. The following if-statement does a sanity check on the input file. We simply return 0 is the section is too small. I'll add some comments spelling this out before I check this in. Mark