From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id AA175385829B for ; Wed, 17 Jan 2024 16:39:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA175385829B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AA175385829B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705509581; cv=none; b=CFnf+m77dj3YVQVE/QKGLsyESB7j8PkUDeWDQzCz8ty7QolWnJ0j+c6XHjUBOWI/e3jwMuAjg61LYqR8gox6rILYlD3/+sFAO5iIw1XyOGfeOXLNvPiy6XTaTOLYHdIUDUUzCeKfFmhB0OEHb9CmlcFQvwbKpcOP/kSBnI294V8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705509581; c=relaxed/simple; bh=DaXtTFgnUAJ48l9LFEtxuI47BXXByNhj4eOQGZqbpjg=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=hA0RbdXs948PWsLjO3Uw8TgLxmohNRacIoouHUet+vjqq0Pid1kULvJ96Zi1y4KtSmrQTuQRhVuk3YJqGhVI4OJNbDvwUQjS4rUVSUpEhdi7+RRnhp89FDYhUnddT5wr1thRqyRwf3tqJymF6uQZyzqSEQFRl90LdG08GoaWP7g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6006a.ext.cloudfilter.net ([10.0.30.182]) by cmsmtp with ESMTPS id Q3efry2xQAxAkQ8xHrDars; Wed, 17 Jan 2024 16:39:55 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Q8x0rlzbsYjq0Q8x1rFREm; Wed, 17 Jan 2024 16:39:39 +0000 X-Authority-Analysis: v=2.4 cv=afxyIDkt c=1 sm=1 tr=0 ts=65a802cb a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=dEuoMetlWLkA:10 a=Qbun_eYptAEA:10 a=CCpqsmhAAAAA:8 a=ku71GV4P9AfvSfq13ykA:9 a=QEXdDO2ut3YA:10 a=ul9cdbp4aOFLsgKbc677:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=AibWWckT//JYH/jonuLbY5IQU7PfqNS2KuOZDg86gSQ=; b=W1RklCFj6ZtiQ4IEUZ2N/+oQR7 TXHaXBaDvaYvopT3/mGMMQ79gGG0T89dwqb6iq9DdH/Br6Vh2LGDmabWJzykpu1lVBPtYwh9PQ93O OudPNPjRwpXSqMHt39c1jDE3v; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:56636 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rQ8x0-002OXE-1k for gdb-patches@sourceware.org; Wed, 17 Jan 2024 09:39:38 -0700 From: Tom Tromey Date: Wed, 17 Jan 2024 09:39:38 -0700 Subject: [PATCH v2 10/17] Empty hash table fix in .debug_names reader MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240117-debug-names-fix-v2-10-dbd5971a9c31@tromey.com> References: <20240117-debug-names-fix-v2-0-dbd5971a9c31@tromey.com> In-Reply-To: <20240117-debug-names-fix-v2-0-dbd5971a9c31@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.68.157 X-Source-L: No X-Exim-ID: 1rQ8x0-002OXE-1k X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-68-157.hlrn.qwest.net ([192.168.0.21]) [97.122.68.157]:56636 X-Source-Auth: tom+tromey.com X-Email-Count: 15 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEK0CpLTs+mKZo5FRJn+7P6rRV1jQ2FrSlfRd/Npes/WzOdmaYG9vnxw+TUoDcxBziYh0Kt6SBiYhsceE1cTV8JsW5RxVLuqn67yspHuU3p+G5JVjgpn s161Sj90QNFVjcDnBDXIvUmIGTB2EtpA4b1z138hN7aUiQTjgVH43EHIW0ldKZSGIaWRJlKHT3aznU71dnYEodsoxkgddu4nm0I= X-Spam-Status: No, score=-3022.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The handling of an empty hash table in the .debug_names reader is slightly wrong. Currently the code assumes there is always an array of hashes. However, section 6.1.1.4.5 Hash Lookup Table says: The optional hash lookup table immediately follows the list of type signatures. and then: The hash lookup table is actually two separate arrays: an array of buckets, followed immediately by an array of hashes. My reading of this is that the hash table as a whole is optional, and so the hashes will not exist in this case. (This also makes sense because the hashes are not useful without the buckets anyway.) Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25950 --- gdb/dwarf2/read-debug-names.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index a2a9fd425ae..b4ff36f0ed6 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -294,7 +294,8 @@ read_debug_names_from_section (struct objfile *objfile, map.bucket_table_reordered = reinterpret_cast (addr); addr += map.bucket_count * 4; map.hash_table_reordered = reinterpret_cast (addr); - addr += map.name_count * 4; + if (map.bucket_count != 0) + addr += map.name_count * 4; /* Name Table */ map.name_table_string_offs_reordered = addr; -- 2.43.0