zsh-workers
 help / color / mirror / code / Atom feed
From: Eduardo Bustamante <dualbus@gmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh-workers@zsh.org
Subject: Re: Zsh parser infinite loop in chuck from utils.c on malformed input
Date: Wed, 10 May 2017 09:57:05 -0500	[thread overview]
Message-ID: <CAOSMAutwKv7Yn1pCotxkhNvK8HNw-Yg4mZwCD9aS2Lmre9NeXQ@mail.gmail.com> (raw)
In-Reply-To: <20170510154555.2a07d67b@pwslap01u.europe.root.pri>

On Wed, May 10, 2017 at 9:45 AM, Peter Stephenson
<p.stephenson@samsung.com> wrote:
[...]
> The problem is NO_EXEC is all things to all people; in the case of a
> shell there isn't really "just" a syntax check, because it's too
> flexible.  The result of a parameter expansion can in some cases have
> a significant effect on what you're doing, in particular if the command
> to execute is part of it.  Being able to parse a parameter substitution
> is itself quite an important check; and there's no fundamental
> difference in the code between looking through the parameter
> substitution and changing the arguments based on what you find.  The
> name NO_EXEC, rather than, say, SYNTAX_CHECK, is significant.
>
> Adding an additional mode that does even less is certainly possible, but
> not necessarily of very wide applicability.

Oh, I agree. Take for example:

  dualbus@debian:~$ for sh in bash ksh93 mksh dash zsh; do echo $sh
$($sh -n <<< 'echo x; ${a$b}' 2>&1); done
  bash
  ksh93 ksh93: syntax error at line 1: `$' unexpected
  mksh
  dash
  zsh zsh: bad substitution

Only ksh93 and zsh are able to detect the problematic parameter
expansion under noexec.

And I don't think there's enough value in implementing an additional
mode. I can just hack the source to disable the bits that I find
problematic for fuzzing.

Thank you for your answers!


      reply	other threads:[~2017-05-10 14:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 14:00 Eduardo Bustamante
2017-05-08 14:17 ` Eduardo Bustamante
2017-05-10  6:43 ` Bart Schaefer
2017-05-10 14:20   ` Eduardo Bustamante
2017-05-10 14:45     ` Peter Stephenson
2017-05-10 14:57       ` Eduardo Bustamante [this message]

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=CAOSMAutwKv7Yn1pCotxkhNvK8HNw-Yg4mZwCD9aS2Lmre9NeXQ@mail.gmail.com \
    --to=dualbus@gmail.com \
    --cc=p.stephenson@samsung.com \
    --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).