From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cPU/GcqozmJh9xEAWB0awg (envelope-from ) for ; Wed, 13 Jul 2022 07:13:14 -0400 Received: by simark.ca (Postfix, from userid 112) id 63E391E5EA; Wed, 13 Jul 2022 07:13:14 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Eo+WmXdw; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 142AB1E21F for ; Wed, 13 Jul 2022 07:13:14 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA01C384D19E for ; Wed, 13 Jul 2022 11:13:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA01C384D19E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1657710793; bh=wKZ47Ly3WGV7RFMDItyYzeyZLRGjWonCJILgUytMEFg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Eo+WmXdwwu0e6GDwhuXCoUKnyzN/nGLmIHWXiB7dtOuwQz3RaKwEaSgLK01zZEDhj XUku8u7FOai7/KTz3h6SJmzN//Trvgi5giNaZMfgggoDxtRTr8UofF9EZGTUwTszuv X2TG1MJGkadumUVvQrfwONNpIImMMogdybPzdC80= Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by sourceware.org (Postfix) with ESMTPS id 259B6384D173 for ; Wed, 13 Jul 2022 11:12:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 259B6384D173 X-IronPort-AV: E=McAfee;i="6400,9594,10406"; a="310815637" X-IronPort-AV: E=Sophos;i="5.92,267,1650956400"; d="scan'208";a="310815637" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2022 04:12:50 -0700 X-IronPort-AV: E=Sophos;i="5.92,267,1650956400"; d="scan'208";a="545800580" Received: from labpcdell3650-003.iul.intel.com (HELO localhost) ([172.28.49.87]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2022 04:12:48 -0700 To: gdb-patches@sourceware.org Subject: [PATCH v4 2/3] gdb, dwarf: add assert to dwarf2_get_pc_bounds Date: Wed, 13 Jul 2022 13:12:25 +0200 Message-Id: <20220713111226.2693410-3-nils-christian.kempke@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713111226.2693410-1-nils-christian.kempke@intel.com> References: <20220713111226.2693410-1-nils-christian.kempke@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Nils-Christian Kempke via Gdb-patches Reply-To: Nils-Christian Kempke Cc: jinisusan.george@amd.com, tom@tromey.com, aburgess@redhat.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" In dwarf2_get_pc_bounds we were writing unchecked to *lowpc. This commit adds a gdb_assert to first check that lowpc != nullptr. Signed-off-by: Nils-Christian Kempke --- gdb/dwarf2/read.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 7ea6c1a7831..456caf364a0 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -13082,6 +13082,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, if (low == 0 && !per_objfile->per_bfd->has_section_at_zero) return PC_BOUNDS_INVALID; + gdb_assert (lowpc != nullptr); *lowpc = low; if (highpc != nullptr) *highpc = high; -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928