From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EsReKFEdmGry7x4AWB0awg (envelope-from ) for ; Wed, 02 Sep 2026 08:57:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1788353873; bh=q1mClIUyo84pAvho6ofMZfWOpgAFl74MzEshRzpSK0Q=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Dk8kv/BYNhrVT4zbDIjRauMFIAtzMMP4uQB1yAuC18AwOmGYlP2RK5rU3AEKScEOv 4gARVUkBHLFAC5SX511w7D7i8qoU/mx1tukhVcvDgJmmnCpVid2v8Q8nn/qtoKTsIP Ya3eVf08RcapIANv5yUJhf7EEolBGbDwVPW77H3s= Received: by simark.ca (Postfix, from userid 112) id 900641E166; Wed, 02 Sep 2026 08:57:53 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=a/GMSmhF; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C899C1E033 for ; Wed, 02 Sep 2026 08:57:52 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 75EBF4BA23C1 for ; Wed, 2 Sep 2026 12:57:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75EBF4BA23C1 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=a/GMSmhF Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 742094BA2E2C for ; Wed, 2 Sep 2026 12:57:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 742094BA2E2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 742094BA2E2C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788353847; cv=none; b=cmSsch6H3X7J9VKkPX/7Y4y0/vfdtv6Ph2GlqoAe+/Y1lHdqBGGJsrPrf2hso8pLgCahIv4Rb0k38DyluPpDuvOVPQMJSlc1MVzvxnQ6y2S7a/2KuH2Ei+1uz5akI9MpqBnUuWa5Jfcj2FYsBS5bQhwfmJ8fSlpLjHWz9RjSstA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788353847; c=relaxed/simple; bh=q1mClIUyo84pAvho6ofMZfWOpgAFl74MzEshRzpSK0Q=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=DqV89fVT6VPT8vKYWX7BUjzUfBCmZWBSDarVu/s7jXU6iT8d4j9cca/crcZHVgKDJ1OLM6ayt9whI2RcofLpNEt2i6QYD8P+NHl3pANUKSunS+qS7tOBkM3OH9Z9hJj+er4NyMmUjoscSZ7ZF7jo1jfBt/34fec9AcBHEmFsIv0= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=a/GMSmhF DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 742094BA2E2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1788353845; bh=q1mClIUyo84pAvho6ofMZfWOpgAFl74MzEshRzpSK0Q=; h=Date:Subject:To:References:From:In-Reply-To:From; b=a/GMSmhFJdgO5GKS9WdRAyEU26qSrps3ZJRzePYxhkMOjCa08TF1jMxYZgYeknJMI 08gd7wdNFCwvAli/pr7CTYwNs4HccXZ0Oh3ELGX2LaNnRXaVfkY4Pj3WTUGEjDyZx1 icdm7gc8CaRmxvH/SrP71e8Zyss8K/gsRoaCPq6A= Received: by simark.ca (Postfix) id 6E13C1E033; Wed, 02 Sep 2026 08:57:25 -0400 (EDT) Message-ID: Date: Wed, 2 Sep 2026 08:57:24 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb-17-branch, gdb/stabs] Fix out-of-bounds write in read_member_functions To: Tom de Vries , gdb-patches@sourceware.org References: <20260902090544.2061258-1-tdevries@suse.de> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260902090544.2061258-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2026-09-02 05:05, Tom de Vries wrote: > gdb/stabsread.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/stabsread.c b/gdb/stabsread.c > index 2d1411e9146..6cc3c5c7e02 100644 > --- a/gdb/stabsread.c > +++ b/gdb/stabsread.c > @@ -5112,6 +5112,7 @@ read_member_functions (struct stab_field_info *fip, const char **pp, > { > if (!is_destructor_name (tmp_sublist->fn_field.physname)) > { > + last_sublist = tmp_sublist; > tmp_sublist = tmp_sublist->next; > continue; > } > @@ -5122,7 +5123,6 @@ read_member_functions (struct stab_field_info *fip, const char **pp, > last_sublist->next = tmp_sublist->next; > else > sublist = tmp_sublist->next; > - last_sublist = tmp_sublist; > tmp_sublist = tmp_sublist->next; > } LGTM. last_sublist is meant to point to the last non-destructor (non-filtetered-out) node. The line you remove makes it point to a destructor node, clearly wrong. If this was for code in master, I would propose adding some comments, like: /* Unlink the destructor. */ if (last_sublist) { /* Destructor is not the first element in linked list, change preceding element's next to point to following element. */ last_sublist->next = tmp_sublist->next; } else { /* Destructor is the first element in linked list, change head (SUBLIST) to point to following element. */ sublist = tmp_sublist->next; } (I wrote these comments locally to make sure I understood the code) And also rename last_sublist to last_non_destructor_sublist. And also switch all this to not use a hand-crafted linked list. But given that this is for code on its way out, the two-liner fix is fine. Approved-By: Simon Marchi Simon