zsh-workers
 help / color / mirror / code / Atom feed
* Valgrind warning from vared -c
@ 2023-02-25 22:31 Bart Schaefer
  2023-03-23  9:03 ` Jun T
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2023-02-25 22:31 UTC (permalink / raw)
  To: Zsh hackers list

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)
==1443300==    by 0x12AB3C: execbuiltin (builtin.c:506)
==1443300==    by 0x155B3E: execcmd_exec (exec.c:4187)
==1443300==    by 0x14F2C6: execpline2 (exec.c:2003)
==1443300==    by 0x14DE4D: execpline (exec.c:1728)
==1443300==    by 0x14D0B7: execlist (exec.c:1482)
==1443300==    by 0x14C6E5: execode (exec.c:1263)
==1443300==    by 0x17419D: loop (init.c:212)
==1443300==    by 0x178D12: zsh_main (init.c:1810)
==1443300==    by 0x129BCC: main (main.c:93)


   1352
   1353     if (zleline && *zleline)
   1354         redrawhook();
   1355


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Valgrind warning from vared -c
  2023-02-25 22:31 Valgrind warning from vared -c Bart Schaefer
@ 2023-03-23  9:03 ` Jun T
  2023-03-31  8:21   ` Jun T
  0 siblings, 1 reply; 4+ messages in thread
From: Jun T @ 2023-03-23  9:03 UTC (permalink / raw)
  To: zsh-workers

(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)
(snip)
>   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;
     }
 #else
-    memcpy(outstr, instr, ll);
+    strcpy(outstr, instr);
     *outll = ll;
     if (outcs)
 	*outcs = incs;





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Valgrind warning from vared -c
  2023-03-23  9:03 ` Jun T
@ 2023-03-31  8:21   ` Jun T
  2023-03-31 14:57     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Jun T @ 2023-03-31  8:21 UTC (permalink / raw)
  To: zsh-workers


> 2023/03/23 18:03, I wrote:
> 
> 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
(snip)

Has anyone tested this patch? Is it OK to push this?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Valgrind warning from vared -c
  2023-03-31  8:21   ` Jun T
@ 2023-03-31 14:57     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2023-03-31 14:57 UTC (permalink / raw)
  To: Jun T; +Cc: zsh-workers

On Fri, Mar 31, 2023 at 1:21 AM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
> Has anyone tested this patch? Is it OK to push this?

I've been traveling the last 2 weeks so more disengaged than recently.

The patch seems fine, yes it may be pushed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-31 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-25 22:31 Valgrind warning from vared -c Bart Schaefer
2023-03-23  9:03 ` Jun T
2023-03-31  8:21   ` Jun T
2023-03-31 14:57     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).