From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32094 invoked by alias); 10 Sep 2003 21:20:35 -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 32058 invoked from network); 10 Sep 2003 21:20:33 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 10 Sep 2003 21:20:33 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h8ALKSl17663 for ; Wed, 10 Sep 2003 17:20:28 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h8ALKRe30506 for ; Wed, 10 Sep 2003 17:20:27 -0400 Received: from localhost.localdomain (vpn50-21.rdu.redhat.com [172.16.50.21]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id h8ALKRba018601 for ; Wed, 10 Sep 2003 17:20:27 -0400 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h8ALKM218958 for gdb-patches@sources.redhat.com; Wed, 10 Sep 2003 14:20:22 -0700 Date: Wed, 10 Sep 2003 21:20:00 -0000 From: Kevin Buettner Message-Id: <1030910212021.ZM18957@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [RFA] dwarf2read.c: Add complaint for out of bounds DW_AT_ranges attribute MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-09/txt/msg00209.txt.bz2 This one's almost obvious... GDB for the FR-V target was segfaulting when issued the "maint check-symtabs" command. Clearly this is an indication that something is wrong with the toolchain elsewhere, but GDB should not segfault when it encounters bad debug info. Okay? * dwarf2read.c (dwarf2_get_pc_bounds): Complain if offset associated with DW_AT_ranges attribute is out of bounds. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.101 diff -u -p -r1.101 dwarf2read.c --- dwarf2read.c 9 Sep 2003 23:23:05 -0000 1.101 +++ dwarf2read.c 10 Sep 2003 21:11:27 -0000 @@ -2253,7 +2253,7 @@ dwarf2_get_pc_bounds (struct die_info *d unsigned int addr_size = cu_header->addr_size; CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1)); /* Value of the DW_AT_ranges attribute is the offset in the - .debug_renges section. */ + .debug_ranges section. */ unsigned int offset = DW_UNSND (attr); /* Base address selection entry. */ CORE_ADDR base; @@ -2266,6 +2266,14 @@ dwarf2_get_pc_bounds (struct die_info *d found_base = cu_header->base_known; base = cu_header->base_address; + + if (offset >= dwarf_ranges_size) + { + complaint (&symfile_complaints, + "Offset %d out of bounds for DW_AT_ranges attribute", + offset); + return 0; + } buffer = dwarf_ranges_buffer + offset; /* Read in the largest possible address. */