From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8133 invoked from network); 2 Apr 2022 23:10:41 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Apr 2022 23:10:41 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1648941041; b=DYI03YtPFBrN2IcKqZ7TrzAT358GkN35TDeGPznOWsrEaeKfhSD3xOkXrxz50drERNrLtDtPNm i3J70tp0hL1N971d71TWEmNTSd8VDvvqNZ9ZKTWIq598HOevU9JSwnwm/CmEL6YdffOVnBAkN6 +gTYeO0nu3G7b8LalJOFeDvlxY+HvSaUUVyMi79kCv+i8HFev9Fi76JfDzpxuviMk5JnE9YAjt rrH7Xo4rJ0hpBN3OlUX7dtooBdRFY1gR2XoO+0d0PhXbictPE69qz3P2IUQM6R0TjPBK4OlmWJ zltgiZcUXWBdReAkGb7j/6YOaxnK+ssC5XY/glR0OCvXjw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1648941041; bh=xwlzGUXyrdNCshM8fjIRlBLLbWXlkVPMbFVzTbIZpqM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:Date:Subject:To:From:DKIM-Signature: DKIM-Signature; b=DpfET9FDbFlb3lw99hIQT8bAXIZnOG01fnW5F+QQTqjx2NAjmFNhIvwyT4X+O3lgwHc9XC69iz MuuZWr5HwIgsBg7bWdry8Bhjzsctpwoks8GCYuUoiompIHcQM0YWVWUNOACzs55BKyHvQBVoKS WmUVSf1FWcZ5BzG7fQx7d/mB+mStPSSsqMJx17IdavJc61P7/Yx0Qx15wtFDr+ZR5JxJhwCDmA O8RMtJocXQZNRxuTck4Z7nr0mDQHyGjutW9Gk5xjFWtP/guqw/L9GblRogGISJcy5rLRQElPs+ 6hc8kPAH+G8GYSz/aXteVzc7Ma/Kz44/zgZahPyRrbs4QA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-Id:Date:Subject:To:From: Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=EI7v/biyFyypYNj4+PI302ToPSBVMErQ7TyH27tQn1I=; b=J4jc57Pr+weYHVXsDBkCKJdeIQ Ka1tPC7UWKc1ebUtUEWZea6UJxLAQGkELcf5ZorwKuDzPo0Lt6uiqq1fogskELeYV1hqk2kUkRibl Zn2QostNJt28GtjgLQr4szMN59OIk0ceLoB9k5mdkXAxkZ6ZlLaN9Ka62UezjO6c4HOzOzNZ+lVlG RSuwDrcyUGIIStJT9Lb4T9pgzqRZ5uJmLZiucTYk1Kb7m3BEt0TobGguduxAlRBeqrYQK6DWowCrY hfuQ031uankTyhU5LOFFIFpKEMnEoE9vM4nFrpMbisFxTmLFaYD62rMYhIoP7D5L3wjtPuxaC2z9A PgBmwmtA==; Received: from authenticated user by zero.zsh.org with local id 1namtE-0009fS-Tr; Sat, 02 Apr 2022 23:10:40 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f176.google.com ([209.85.208.176]:34430) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1namt2-0009L7-82; Sat, 02 Apr 2022 23:10:29 +0000 Received: by mail-lj1-f176.google.com with SMTP id 17so8498555lji.1 for ; Sat, 02 Apr 2022 16:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id; bh=EI7v/biyFyypYNj4+PI302ToPSBVMErQ7TyH27tQn1I=; b=X+YWgIuXWpLe098WLM3GgGSvWKIFh3oplk8fFrVh8mYT/O2x24GCnU0rM+/0ueDEPL F9U56fE+H3rVJRG/MC13LBA/AAe58nCTnMBMetFtg5Oxk3ZbmdlX3JIWJvyuExoLffP5 WahxQ+jd2pG+4pcvIvuJ7EPnW61rM7FmA0EEPraT2hSr+HwzPO2CavUG+IAuTBQpLtei mOQfKzWSqVk9CBd0LKTz98Nytgc5j6plHLUa+wzHuJFKuPcQJjBfJvxsOltbxx/TyCuI W2iCwhH3dZkAHZfaimVrP8i+qky9u+1lTx7rQoD07UeLzpwtCdcZoPExZoJxY7t0aJy4 pVdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id; bh=EI7v/biyFyypYNj4+PI302ToPSBVMErQ7TyH27tQn1I=; b=y4TJIOr1GkZb8XsOMv6Pi3EtOk1I8tuuj866u4RgOiY7OjHP81n2CSJpeRXnK7ZVr1 JS5zogJn8odp6r8Wpt+qhvsIVGdWAoNT76ZWyqvR/eRuEhmodiYCvIlSm4eP+PQyjyac P/sW/eKPSiLaYBzNHU8XqzXeznwHs8iPm4doQxQ3H9Cf+O5zup7MfIjeirrho3zB4DN0 r8wASACuCaiZVLFFWd49xrteLp1ViV/7bYWEaC9Op5Nm2q8Qx7mJJa40s+quaKTIVMuS Ta5+/znyx2vq+wXU3KO+i0pYB/cyr294ldZm54LKAXHyt74hxsHLQaKG+xdjEc39KMX5 i/rw== X-Gm-Message-State: AOAM530AwTQKnzI30RrgRWLXS2n7f2uYaAOHftjeq2W06UxouaWjux0Z 3JQJCzNXhb9ToKxmeG1BHm8lHRPiOrY= X-Google-Smtp-Source: ABdhPJwe1WfiFuYLY0sK/lv3fCeCskG5NFpWnVbCYF97Dcj22jobgVhOxJV6lP/LSzfwu2N2j8GgXg== X-Received: by 2002:a2e:96ca:0:b0:249:8013:cf07 with SMTP id d10-20020a2e96ca000000b002498013cf07mr16838238ljj.440.1648941027077; Sat, 02 Apr 2022 16:10:27 -0700 (PDT) Received: from localhost.localdomain (h-212-85-88-110.A230.priv.bahnhof.se. [212.85.88.110]) by smtp.gmail.com with ESMTPSA id i3-20020a198c43000000b00448a1566977sm641653lfj.275.2022.04.02.16.10.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Apr 2022 16:10:26 -0700 (PDT) From: Mikael Magnusson To: zsh-workers@zsh.org Subject: PATCH: Brown paper bag for 49915 Date: Sun, 3 Apr 2022 01:10:21 +0200 Message-Id: <20220402231021.5539-1-mikachu@gmail.com> X-Mailer: git-send-email 2.15.1 X-Seq: 49957 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: The code would crash when n == 0. There's not really any point doing any of this when n is 0 so just skip everything. It also tried to NULL terminate a list a little to eagerly. --- Src/Zle/compcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 99f58a0897..607ac25bb4 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -3247,7 +3247,7 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp) } *cp = NULL; } - } else { + } else if (n > 0) { if (!(flags & CGF_NOSORT)) { /* Now sort the array (it contains matches). */ matchorder = flags; @@ -3320,8 +3320,8 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp) } *ap = *bp; } + *ap = NULL; } - *ap = NULL; /* passed -1 but not -2, so remove consecutive duplicates (efficient) */ } else if (!(flags & CGF_UNIQCON)) { int dup; -- 2.15.1