From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6+z5ARfCB2C4TgAAWB0awg (envelope-from ) for ; Wed, 20 Jan 2021 00:39:35 -0500 Received: by simark.ca (Postfix, from userid 112) id CC6171EF7C; Wed, 20 Jan 2021 00:39:34 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 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 7279E1EF7C for ; Wed, 20 Jan 2021 00:39:31 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 246403947433; Wed, 20 Jan 2021 05:39:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 246403947433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611121171; bh=9RUb4HqFvm5iaebo/SpTMpcsm8z6ydxyjRCNm0mFQiE=; 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=Ni0jwGEyMyl2RpL9l42ebArLgzyst1KVSIgsar4KQMrk4gmwkbhkYo9z7GWJdAtgV 1fSFfs8swkNgQ1e4k6eay5F4bKARDXmR4U5i9PR5MwxYNAvYyLisGR7KfGfdu14sa5 7PG1UYJYVbFfjQe8X/VBjzlVn8kRQu9Izw1AFMVI= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 674AC3870914 for ; Wed, 20 Jan 2021 05:39:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 674AC3870914 X-ASG-Debug-ID: 1611121166-0c856e6cd571f1d0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id DrTMeoSWW3bzDuTG (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Jan 2021 00:39:26 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id 0331F441D64; Wed, 20 Jan 2021 00:39:26 -0500 (EST) X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 01/13] gdb/dwarf: change read_loclist_index complaints into errors Date: Wed, 20 Jan 2021 00:39:13 -0500 X-ASG-Orig-Subj: [PATCH 01/13] gdb/dwarf: change read_loclist_index complaints into errors Message-Id: <20210120053925.142862-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210120053925.142862-1-simon.marchi@polymtl.ca> References: <20210120053925.142862-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1611121166 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 2118 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.87375 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" From: Simon Marchi Unlike read_rnglists_index, read_loclist_index uses complaints when it detects an inconsistency (a DW_FORM_loclistx value without a .debug_loclists section or an offset outside of the section). I really think they should be errors, since there's no point in continuing if this situation happens, we will likely segfault or read garbage. gdb/ChangeLog: * dwarf2/read.c (read_loclist_index): Change complaints into errors. Change-Id: Ic3a1cf6e682d47cb6e739dd76fd7ca5be2637e10 --- gdb/dwarf2/read.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 9032186ef89e..2b76ed001616 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -20190,19 +20190,22 @@ read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index) section->read (objfile); if (section->buffer == NULL) - complaint (_("DW_FORM_loclistx used without .debug_loclists " - "section [in module %s]"), objfile_name (objfile)); + error (_("DW_FORM_loclistx used without .debug_loclists " + "section [in module %s]"), objfile_name (objfile)); + struct loclists_rnglists_header header; read_loclists_rnglists_header (&header, section); if (loclist_index >= header.offset_entry_count) - complaint (_("DW_FORM_loclistx pointing outside of " - ".debug_loclists offset array [in module %s]"), - objfile_name (objfile)); + error (_("DW_FORM_loclistx pointing outside of " + ".debug_loclists offset array [in module %s]"), + objfile_name (objfile)); + if (loclist_base + loclist_index * cu->header.offset_size >= section->size) - complaint (_("DW_FORM_loclistx pointing outside of " - ".debug_loclists section [in module %s]"), - objfile_name (objfile)); + error (_("DW_FORM_loclistx pointing outside of " + ".debug_loclists section [in module %s]"), + objfile_name (objfile)); + const gdb_byte *info_ptr = section->buffer + loclist_base + loclist_index * cu->header.offset_size; -- 2.30.0