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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4
Received: (qmail 32393 invoked from network); 30 Apr 2023 17:31:43 -0000
Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368)
by inbox.vuxu.org with ESMTPUTF8; 30 Apr 2023 17:31:43 -0000
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1682875904;
b=hoY5JzMV1dKDnAPWa/zcYNInUmCEjnyEaLMQEH/+bG+KQenN0Dp0jtQ3mV0aDBFD+X0Ia2VsRH
aKoYNlvPzxkPBwtPwRpKB8OFIAPa9Y5JnQLzkDn6kqHIr7ane0XxCgNhXGkxHIyCLpnDPkur/q
rYvgFS5JdP6XoSdk7I7FfZ4e+8UOksnykfisx/cieAKJZ6bPoGESe4wBP7LO0tmAvKchQK5dkf
eIccJzylUxVfyqm4tV7YzlC4Is9hMgkuTF5hlUIcEbJyZK6pkkv6eZGwyftPRsI7wrpahkp6vv
/5Ktktp6cdxtm9wdJ54hAhqpAR3koCp/CpdQwQTgZ6qieQ==;
ARC-Authentication-Results: i=1; zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1682875904;
bh=ovGSpxo+FgkGldlOjTG42NKcCcjVFVCStV0HE/fWTHM=;
h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help:
List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type:
References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature:
DKIM-Signature;
b=OXPrSa9aZvA94bO5gKXO3OM40ODHH7HYEI0PGbp0fCcOQqvyDAgcAeyGLhtsnczBMSx5C/50rK
yTjjesZRZr8GzqMUhtGnP79nbyU9sQDCQAPQ6vZdjnzkHyQ7qKH+Fg2RfKbAfVWJiz6h0rXnaM
XLooZjXi9qDxKUrMFgggbGtpsWR8Rp+e0T6VKlQoOTU/YDGqsu/ukuVaiZW9VWGwRfEtPBBLjl
XdrjMTqfHS0W9haZ+OtvaBVET8lF4SX7NnjOR3LUxg2+LvOIsdZWb7nDX/HW6XuwtFecinVhXg
oNSy3zWsYEw8PUEfUfDbvzZzVFIQJsz8gZmoeX1EvVzLqw==;
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:Content-Transfer-Encoding:
Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject:
Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From
:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
bh=YqO6AaT5VSlh6tjtXlObE7TIQPhwaacyWRqQjkDY99M=; b=ho8/pCItH/kf8qaWkjBBMlXE46
pwodQuYSsMZd0v69JnAmpNiOyHuR/bRMiqR7XSJJNvDBu5IaeI3jOf/p6y4gYUsU8zEWlIpd1GlbY
jxOiSXkHgEgn8aAcXC3S7m4O/8gQBNCiyb2T7ZvpttARSK7mOkPJOEMg6NVgrRM/OBmtKux62kU8r
3ZQ2faochDQ2ixy/zMwVXHLdq//bh1uKrTRAuv9kCZFoK7A+57pHc28vV1ZZYTjB37djwn/edNqOq
THW+hDpyJL7xOz45ygVCq8X9LX6zHvRd9eyIT7fZelnccnm0tc6JotOG7sOTwMvfNrw400MHtUAq6
Qx33zJbw==;
Received: by zero.zsh.org with local
id 1ptAtg-0000k2-TF;
Sun, 30 Apr 2023 17:31:40 +0000
Authentication-Results: zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:39346)
by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
id 1ptAt2-0000Pv-KK;
Sun, 30 Apr 2023 17:31:07 +0000
Received: from [212.54.57.108] (helo=csmtp4.tb.ukmail.iss.as9143.net)
by smtpq2.tb.ukmail.iss.as9143.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1)
(envelope-from
)
id 1ptAt2-0001IG-7m
for zsh-workers@zsh.org; Sun, 30 Apr 2023 19:31:00 +0200
Received: from pws-Zeus ([82.1.229.179])
by cmsmtp with ESMTPA
id tAt1pdEJoPjoOtAt1pSMXl; Sun, 30 Apr 2023 19:31:00 +0200
X-SourceIP: 82.1.229.179
X-Authenticated-Sender: p.w.stephenson@ntlworld.com
X-Spam: 0
X-Authority: v=2.4 cv=O8n//jxW c=1 sm=1 tr=0 ts=644ea5d4 cx=a_exe
a=W4rGJ7PGCSRRUvufKHO8Dg==:117 a=W4rGJ7PGCSRRUvufKHO8Dg==:17
a=IkcTkHD0fZMA:10 a=dKHAf1wccvYA:10 a=wTYo7YpbjTrfH2KeI5MA:9 a=QEXdDO2ut3YA:10
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com;
s=meg.feb2017; t=1682875860;
bh=YqO6AaT5VSlh6tjtXlObE7TIQPhwaacyWRqQjkDY99M=;
h=Subject:From:To:Date:In-Reply-To:References;
b=I7bPV5nUHu0K0+nLgI9uY8EL5yxEUCG/qhbDPznHiQv38KDWsTBS81jJzIF0YARls
qygZHxjSWsUPeevdcAm5Q0rGRaDKV+oMCUDlZfA4XK/sHwhWCSNYdwW+2KzDKvwThf
KDwMaEcSZaqvX/SDeC3LuBbORqwc4ajKBIEXSaHDkMDyWEkTy4Dr4bybZKK6CkhcDy
p252cBgIok0LTUED7RgmZVkLIXRfH3v+XV+prrOaPl5kVzZUAXjvcOGcy0FGABakIy
fdzSg2CWpqu2xs4L/wUJ2IKjwk3k9/KvZimKzfYXoYGi2UjC2HfFP1fJWtvJSd+OHg
nB1gfTGe5BMJQ==
Message-ID: <9a4279398cabea525bb77662418ad536be7770bc.camel@ntlworld.com>
Subject: Re: [BUG] sigsegv
From: Peter Stephenson
To: Zsh hackers list
Date: Sun, 30 Apr 2023 18:30:59 +0100
In-Reply-To:
References:
<886115150.3264962.1682430985767@mail.virginmedia.com>
<384683842.2892075.1682682065470@mail.virginmedia.com>
<1209713483.9390210.1682691745248@mail.virginmedia.com>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
X-CMAE-Envelope: MS4xfEhLJqQLZP88zOW6Orm8G5WEz6wcQQdE0e/9QhUpuO94m+XKCSbi241p9dnWdMGjSZsy/5+g7PxXdzgV256vqjSLFRyUmCizLVOUERsJ5iZxNf79HsRR
PE0Gm51H10kvulgc+sCqRv+9sw/CLcJy2Ecx0c1rfjkj0bivQuSbCKJd2TgJk7vqeZzqV3TTKzEjEA==
X-Seq: 51688
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:
On Sat, 2023-04-29 at 10:52 +0000, Sebastian Gniazdowski wrote:
> It says "incomplete sequence \339" although egrep $'\330' ~/.zhistory
> doesn't return anything…
So it looks like this is probably confusion over bad or incomplete
multibyte characters again.
Rather than bufferwords() --- I think that's not relevant at this point
--- this could be the code that reads a history line back into the buffer
and divides it into words getting confused. This is different from
the code that adds to a history line when it's first generated and
likely to be less accurate --- and also fits better with the
reproducibility of this problem.
Anyway, given there's no single place where the line originates,
and given that we're probably not going to be able to turn it into
a proper line if the there's not a complete character sequence,
safety at the point in question is probably the best we've got.
See if this helps.
pws
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 96a211c69..2067f5bab 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -1233,9 +1233,16 @@ histwgetfn(UNUSED(Param pm))
pushnode(l, getdata(n));
while (he) {
+ char *hstr = he->node.nam;
+ int len = strlen(hstr);
for (iw = he->nwords - 1; iw >= 0; iw--) {
- h = he->node.nam + he->words[iw * 2];
- e = he->node.nam + he->words[iw * 2 + 1];
+ int wbegin = he->words[iw * 2];
+ int wend = he->words[iw * 2 + 1];
+
+ if (wbegin >= len || wend > len)
+ break;
+ h = hstr + wbegin;
+ e = hstr + wend;
sav = *e;
*e = '\0';
addlinknode(l, dupstring(h));