dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tiemeezeiv@wilsonb.com
To: dash@vger.kernel.org
Subject: Stack overflow on unbounded recursion
Date: Thu, 28 May 2020 17:17:38 +0900	[thread overview]
Message-ID: <2PA16BT5WNILQ.2352UZK7LJF4P@wilsonb.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 798 bytes --]

Tested this against master at commit 3e3e7af1:

    $ src/dash -c 'f(){ f;};f'
    segfault

Of course this is a pathological command string, but it looks like a clear case
of stack overflow:

    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000407762 in argstr (p=0x4204b0 "f", flag=flag@entry=3) at expand.c:249
    249             int breakall = (flag & (EXP_WORD | EXP_QUOTED)) == EXP_WORD;
    (gdb) info proc mappings
          ...
          0x7ffff7ffe000     0x7ffff7fff000     0x1000        0x0
          0x7fffff7ff000     0x7ffffffff000   0x800000        0x0 [stack]
    (gdb) p/x $rsp
    $1 = 0x7fffff7fef50
    (gdb) x/i $rip
    => 0x407762 <argstr+34>:        sete   0x7(%rsp)

Is this a bug or have I just stumbled into a known "feature"?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

                 reply	other threads:[~2020-05-28  8:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2PA16BT5WNILQ.2352UZK7LJF4P@wilsonb.com \
    --to=tiemeezeiv@wilsonb.com \
    --cc=dash@vger.kernel.org \
    --subject='Re: Stack overflow on unbounded recursion' \
    /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

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