Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH 1/5: Fix reading outside string in termquery.c
- X-seq: zsh-workers 54489
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: PATCH 1/5: Fix reading outside string in termquery.c
- Date: Thu, 7 May 2026 04:04:36 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=sNPREKduJ2tGv4HGOMfMFlALo8N6pXc6Alb3HvvIMPw=; fh=2tfr1lXayzVavkTg6fWPRiWcFKi2aZa5ShWfwjU9vZo=; b=NFZ6Suwzn8/Ld1EseUC1T7Rdo/2neRVG4TlZl8mWFvPDI0AuaGPqTMAcw4IpDPaa4D J8f7mfV1DS+G1BF8DHckGB3/EdEUIiPQDnHz+C+cf7qHmfHmJJoTdoZ6qwfkP/oSmaBP Z9CJ8D8OuyI2ABjnKMx7s9GUmiO7LgoURiRtus3JQM4pJ4iPUv7R4hqwsvPgGAJPFEza I9Fvr30qQWI4LnqTpwsQDNSS3OnmyxIZESpACOOtF21Y5v+ibzM3LiHF6ThEogvFpnLj s6u5qDpAhJ0BXEPnYox1OvT6WIvitERiDD38qeajp8u7Q+B6gqQJrOuQkyKUohefCf92 vxTw==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1778119490; cv=none; d=google.com; s=arc-20240605; b=NPad9EFjCbxSTRCArWHaEwgZRucm5so9ETkX0xpRFgQI0D7hp6JV6xaDthXoGf4sQl DpbMBWslcI3Fax/4rN3lgI4Mng1lrS5PqT4dr4+kJx5csO/lDydRNzXfgl/Xfki3hwxX ptl0X1yB7KTP1z4CPVRM8KdaWZDRIdnTkYfdeIyjpUTbTV7WJCYRz2StefgSDfqC4Q5X tIBQkH6uoSg6UlnkYnZ40aw0EH0F160bqo5vXtsThhfzfxBV3hw0OBlvdRAfdDjxK5nZ SzKnOGop++GQ5w6XUvu5bbj4szVy515mKEXAchE0lyQUb5Jgq6Caw/jhh23bzPRbKQMs oHmA==
- Archived-at: <https://zsh.org/workers/54489>
- In-reply-to: <44742-1778111072.334507@6E2o.mG-q.ddaE>
- List-id: <zsh-workers.zsh.org>
- References: <20260506092334.6984-1-mikachu@gmail.com> <44742-1778111072.334507@6E2o.mG-q.ddaE>
On Thu, May 7, 2026 at 1:44 AM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> Mikael Magnusson wrote:
> > + (strlen(*e + negate) >= editext[i].class &&
>
> Having reviewed the condition again more closely, I'd propose the following
> instead. It'd be good if you could retest with valgrind because I wasn't
> able to reproduce the error. What options are you using with valgrind?
I retested and confirmed this patch also makes the warning go away. I
wasn't using any special options to trigger the warning, but I used
these to hide other junk: -q --trace-children=no --leak-check=no
And later when I jury-rigged valgrind into the test Makefile, I did this:
valgrind --leak-check=no --log-fd=13 --trace-children=yes
--trace-children-skip=/bin/\*,/usr/bin/\* $(dir_top)/Src/zsh +Z -f
$(sdir)/$$ZTST_handler; then \
with the 13 just being the fd I got from exec {myfd}>valgrind.log in
the shell where I was going to run make check. Running the tests this
way takes ~30 minutes on my old computer, and it does cause a number
of the tests to fail with mysterious errors, but it gave me the other
four warnings.
--
Mikael Magnusson
> Also, I needed to check what I wrote in the documentation and noticed a
> line where an extra comma would add clarity.
>
> Oliver
>
> diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
> index ead52065a..4d44ecf21 100644
> --- a/Doc/Zsh/zle.yo
> +++ b/Doc/Zsh/zle.yo
> @@ -2636,7 +2636,7 @@ as by adding `tt(-cursor)' to disable cursor shape and color changing.
>
> When ZLE starts, it will add entries for features that were auto-detected. This
> auto-detection uses extensions itself, all named with a `tt(query)' prefix. As
> -this happens when ZLE starts disabling them needs to be done early in the
> +this happens when ZLE starts, disabling them needs to be done early in the
> startup files. A value of `tt(-query)' will disable all terminal queries on
> startup, including those that query terminal properties such as colors rather
> than detecting features. Populating the array with the status of auto-detected
> diff --git a/Src/Zle/termquery.c b/Src/Zle/termquery.c
> index ef6f013b2..4d034a7fe 100644
> --- a/Src/Zle/termquery.c
> +++ b/Src/Zle/termquery.c
> @@ -707,11 +707,11 @@ collate_seq(int sindex, int dir)
> int negate = (**e == '-');
> if (negate != enabled)
> continue;
> - if ((editext[i].class &&
> - !strncmp(*e + negate, editext[i].key, editext[i].class) &&
> - !*(*e + negate + editext[i].class)) ||
> + if ((!editext[i].class ||
> + !strncmp(*e + negate, editext[i].key, editext[i].class)) &&
> + ((editext[i].class && !*(*e + negate + editext[i].class)) ||
> !strcmp(*e + negate + editext[i].class,
> - editext[i].key + editext[i].class))
> + editext[i].key + editext[i].class)))
> {
> enabled = !negate;
> break;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author