zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: PATCH: (?) Some kind of freeundo crash thing
Date: Wed, 11 Nov 2015 15:58:03 +0000	[thread overview]
Message-ID: <20151111155803.5769db50@pwslap01u.europe.root.pri> (raw)

Doesn't seem very easy to provoke.  Must be freeing lastline:

(gdb) p lastline
$1 = (ZLE_STRING_T) 0x1bde2a0 L"make clean\xffffffff\xffffffff\x1cc99f0"
(gdb) p lastlinesz
$2 = 10
(gdb) p sz
$3 = 0
(gdb) p osz
$4 = 10

which actually looks OK.  I think sz == 0 because of ZSH_SECURE_FREE.

I wonder if this could be a double free?  We don't unset lastline if we
free it...

#0  0x0000000000470545 in zfree (p=0x1bde2a0, sz=0) at mem.c:1501
#1  0x00002b6fe89ebb72 in freeundo () at zle_utils.c:1438
#2  0x00002b6fe89cca91 in zleread (lp=0x6f64e8, rp=0x0, flags=7, context=0, 
    init=0x2b6fe89f4188 "zle-line-init", 
    finish=0x2b6fe89f4178 "zle-line-finish") at zle_main.c:1284
#3  0x00002b6fe89cf563 in zle_main_entry (cmd=1, ap=0x7fff3dc74d20)
    at zle_main.c:1930
#4  0x0000000000456f03 in zleentry (cmd=1) at init.c:1523
#5  0x00000000004580b5 in inputline () at input.c:293
#6  0x0000000000457f16 in ingetc () at input.c:226
#7  0x000000000044ac92 in ihgetc () at hist.c:391
#8  0x0000000000462466 in gettok () at lex.c:605
#9  0x0000000000461b5f in zshlex () at lex.c:271
#10 0x000000000048926a in parse_event (endtok=37) at parse.c:561
#11 0x0000000000453566 in loop (toplevel=1, justonce=0) at init.c:146
#12 0x0000000000457403 in zsh_main (argc=1, argv=0x7fff3dc752a8) at init.c:1678
#13 0x000000000040f434 in main (argc=1, argv=0x7fff3dc752a8) at ./main.c:93

diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index ffff8fd..6e9a98b 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1436,6 +1436,8 @@ freeundo(void)
     freechanges(changes);
     freechanges(nextchanges);
     zfree(lastline, lastlinesz);
+    lastline = NULL;
+    lastlinesz = 0;
 }
 
 /**/


pws


                 reply	other threads:[~2015-11-11 15:58 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=20151111155803.5769db50@pwslap01u.europe.root.pri \
    --to=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).