help / color / mirror / code / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: Valgrind warning from vared -c
Date: Thu, 23 Mar 2023 18:03:30 +0900	[thread overview]
Message-ID: <DB863865-003E-4DC5-A88D-4CF570984F30@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAH+w=7aF58LSfXLPAWORcD=hMsZ1aOhNbkYzHdbWEUXXJtCBVA@mail.gmail.com>

(I was not able to follow workers these days, and am now trying
 to catch up with it...slowly)

> 2023/02/26 7:31, Bart Schaefer <schaefer@brasslantern.com> wrote:
> Doesn't happen on vared of an existing param, as far as I can tell.
> ==1443300== Conditional jump or move depends on uninitialised value(s)
> ==1443300==    at 0x2612D1: zleread (zle_main.c:1353)
> ==1443300==    by 0x263333: bin_vared (zle_main.c:1833)
>   1353     if (zleline && *zleline)
>   1354         redrawhook();

It seems *zleline is not set correctly when zleline is empty.
Please try the following:

diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 454a877a9..51bb43339 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -512,12 +512,13 @@ stringaszleline(char *instr, int incs, int *outll, int *outsz, int *outcs)
 	    *outcs = outptr - outstr;
 	*outll = outptr - outstr;
     } else {
+	*outstr = ZWC('\0');
 	*outll = 0;
 	if (outcs)
 	    *outcs = 0;
-    memcpy(outstr, instr, ll);
+    strcpy(outstr, instr);
     *outll = ll;
     if (outcs)
 	*outcs = incs;

  reply	other threads:[~2023-03-23  9:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-25 22:31 Bart Schaefer
2023-03-23  9:03 ` Jun T [this message]
2023-03-31  8:21   ` Jun T
2023-03-31 14:57     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB863865-003E-4DC5-A88D-4CF570984F30@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).