From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eCqbHBzCB2C4TgAAWB0awg (envelope-from ) for ; Wed, 20 Jan 2021 00:39:40 -0500 Received: by simark.ca (Postfix, from userid 112) id 732A81EF7C; Wed, 20 Jan 2021 00:39:40 -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 3EC4F1EF84 for ; Wed, 20 Jan 2021 00:39:33 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8ECD43947C24; Wed, 20 Jan 2021 05:39:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8ECD43947C24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611121172; bh=3vfZOzDctm0ZLhmThIai/nAVXu+4COZcXaj/osy12/0=; 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=PcAVWt2YUh1JCYzMYRDM4DmeSnl4FTiuteIfDv1oKCudfjJKMT+JsjI5UewWi5RPw qmc/Mc+p+0kfKMfcQ3iXvSO0YLsheo+fKp6ybvLwiymUCtjhm1UMW/hMNf3ivJnzqJ OhK4woaX5egyaiWcoyqoyFrGjogUcqdaXNqUxiiU= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 971F5394742B for ; Wed, 20 Jan 2021 05:39:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 971F5394742B X-ASG-Debug-ID: 1611121166-0c856e67e246f730001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id gTB5AdOgcm9SgAEt (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 3E440441D67; 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 04/13] gdb/dwarf: remove unnecessary check in read_{rng, loc}list_index Date: Wed, 20 Jan 2021 00:39:16 -0500 X-ASG-Orig-Subj: [PATCH 04/13] gdb/dwarf: remove unnecessary check in read_{rng, loc}list_index Message-Id: <20210120053925.142862-5-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: 2026 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 In read_rnglist_index and read_loclist_index, we check that both the start and end of the offset that we read from the offset table are within the section. I think it's unecessary to do both: if the end of the offset is within the section, then surely the start of the offset is within it. Remove the check for the start of the offset in both functions. gdb/ChangeLog: * dwarf2/read.c (read_loclist_index): Remove bound check for start of offset. (read_rnglist_index): Likewise. Change-Id: I7b57ddf4f8a8a28971738f0e3f3af62108f9e19a --- gdb/dwarf2/read.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 848c15330435..76044187bf76 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -20205,11 +20205,6 @@ read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index) ".debug_loclists offset array [in module %s]"), objfile_name (objfile)); - if (start_offset >= section->size) - error (_("DW_FORM_loclistx pointing outside of " - ".debug_loclists section [in module %s]"), - objfile_name (objfile)); - /* Validate that reading won't go beyond the end of the section. */ if (start_offset + cu->header.offset_size > section->size) error (_("Reading DW_FORM_loclistx index beyond end of" @@ -20261,12 +20256,6 @@ read_rnglist_index (struct dwarf2_cu *cu, ULONGEST rnglist_index, ".debug_rnglists offset array [in module %s]"), objfile_name (objfile)); - /* Validate that the offset is within the section's range. */ - if (start_offset >= section->size) - error (_("DW_FORM_rnglistx pointing outside of " - ".debug_rnglists section [in module %s]"), - objfile_name (objfile)); - /* Validate that reading won't go beyond the end of the section. */ if (start_offset + cu->header.offset_size > section->size) error (_("Reading DW_FORM_rnglistx index beyond end of" -- 2.30.0