zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: Warnings in compctl
Date: Sat, 12 May 2018 12:29:16 +0200	[thread overview]
Message-ID: <20533.1526120956@thecus> (raw)
In-Reply-To: <46F08EE7-DA1F-49E5-8E74-4D519E47ACBD@kba.biglobe.ne.jp>

On 23 Mar, Jun T wrote:
> Three more files (complete.c, computil.c, zle_thingy.c) have the same
> "off the front" pointer assignments; these are detected by
> "clang -Warray-bounds-pointer-arithmetic".

One of these changes now triggers stack-use-after-scope in the address
sanitizer because skip_this_arg is declared inside the while loop but is
accessed in the while loop's condition.

Oliver

diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 5601c1178..6b892b822 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -725,13 +725,13 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
 	remetafy = 0;
 
     while (*args && **args == '-') {
+	char skip_this_arg[2] = "x";
 	char *num;
 	if (!args[0][1] || args[0][1] == '-') {
 	    args++;
 	    break;
 	}
 	while (*++(*args)) {
-	    char skip_this_arg[2] = "x";
 	    switch (**args) {
 	    case 'n':
 		num = args[0][1] ? args[0]+1 : args[1];


  parent reply	other threads:[~2018-05-12 10:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180321101631eucas1p281904e89d2bc29ef8fa0c3c0aa6b06d6@eucas1p2.samsung.com>
2018-03-21 10:16 ` Peter Stephenson
2018-03-23  3:38   ` Jun T
2018-03-23  9:32     ` Peter Stephenson
2018-05-12 10:29     ` Oliver Kiddle [this message]
2018-05-12 12:57   ` Eitan Adler

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20533.1526120956@thecus \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

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