From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id AA1AC385773E for ; Wed, 10 May 2023 13:41:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA1AC385773E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-52c6f8ba7e3so6662857a12.3 for ; Wed, 10 May 2023 06:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683726084; x=1686318084; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=ODgPJDuYvbre6224707BIFogN3wr0XtiXgAzt91cs00=; b=i0zBrq9xtviJRTtK8LebJRRK0e2IgVfoHSuwR12Q9//Rzb/4RQJuoiSOzKW+xCcQu1 hX/kxB+gqa2oNRQ5dslHQTkHJ29psQ5TVxb1hGEs7PB3BJsOsaJtQPQHvExo7kw9EXHn iUjE/W0JxkwhybU9MtJgREZsign3qclVvFwh86dkJm9gXOgBfaGBRD/0CAxfIiwT08IB T7QpHviVdVXK4eAINyG34jF6LIGnGz24d0EM+a4cJgqwh1PFDT6CuGM1kUOFdT5GbIar 8rfMxut1abQElvvBxAPMG0+xMHnr3tOyloAE9sDbh+zU9BgStFWt2rIq0626AmLwYnQO a/tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683726084; x=1686318084; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ODgPJDuYvbre6224707BIFogN3wr0XtiXgAzt91cs00=; b=YyuJDOb5nIPHr7+UK37rjK9qq1vRCVuGzLheZJP1Q97yVKgP+1HeuHvFK8BmULYyFI Tc9vU04FSZm8fHbsNbqCdZniEFQ5iItGLeyGYXPnu8sD5jkEuhAVNY4ch2IFTKQ0Jfcf EjGt9o7GUX2+JWXIWLTrXrG1G4loG1ajJEj4E0HF12My7nQRIPZ3u9jxaqsKzt2LlxHt cuPE/f6hckx/nqBu6wuRPxB9o06dGOoOw6295vNYamp3IU7wV2KZkDkGrdurfnwKQzio qL/BL9LZbbtM0F88d3ToxPLdgDsMo6/SOCZ6Bfp4zBDkhp43oqctIQAcbHIEg6+a8ylW UOHg== X-Gm-Message-State: AC+VfDx5jD629dpX1crlTqe1NrDDZbAdgoJX/o+yHhksL62rpz73zpBG TWORHRKJneHulblSVGX7oTwHZpygRb8= X-Google-Smtp-Source: ACHHUZ4ds4TkDs3Z0qUc7iXZ3GtyjKoPFv7NyqnTySwxtTN99+nByeghAMZ+OrK9KkNu4k+/JQWrwQ== X-Received: by 2002:a17:902:b20a:b0:1ac:3e90:7c4 with SMTP id t10-20020a170902b20a00b001ac3e9007c4mr17316198plr.2.1683726084096; Wed, 10 May 2023 06:41:24 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id u11-20020a170902a60b00b001ab1a737c8dsm3739824plq.285.2023.05.10.06.41.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 06:41:23 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id ABEFA1142CD2; Wed, 10 May 2023 23:11:20 +0930 (ACST) Date: Wed, 10 May 2023 23:11:20 +0930 From: Alan Modra To: binutils@sourceware.org Subject: Re: stack overflow in debug_write_type Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3034.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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: Apparently u.kindirect->slot can point at a NULL. * debug.c (debug_write_type): Don't segfault on NULL indirect. diff --git a/binutils/debug.c b/binutils/debug.c index 5cc77f74906..bb26d9143d0 100644 --- a/binutils/debug.c +++ b/binutils/debug.c @@ -2490,7 +2490,8 @@ debug_write_type (struct debug_handle *info, return false; case DEBUG_KIND_INDIRECT: /* Prevent infinite recursion. */ - if ((*type->u.kindirect->slot)->mark == info->mark) + if (*type->u.kindirect->slot != DEBUG_TYPE_NULL + && (*type->u.kindirect->slot)->mark == info->mark) return (*fns->empty_type) (fhandle); return debug_write_type (info, fns, fhandle, *type->u.kindirect->slot, name); -- Alan Modra Australia Development Lab, IBM