zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: PATCH: valgrind complains about init_keymaps
Date: Tue, 20 Dec 2011 08:38:28 -0800	[thread overview]
Message-ID: <111220083828.ZM11120@torch.brasslantern.com> (raw)

While testing something else I accidentally executed a command out of my
history that started up my latest zsh build under valgrind.  Got a bunch
of these:

==10918== Conditional jump or move depends on uninitialised value(s)
==10918==    at 0x80C5593: metafy (utils.c:3962)
==10918==    by 0x810F9F2: bindkey (zle_keymap.c:547)
==10918==    by 0x811123C: add_cursor_key (zle_keymap.c:1253)
==10918==    by 0x8111540: default_bindings (zle_keymap.c:1329)
==10918==    by 0x81110E4: init_keymaps (zle_keymap.c:1192)

==10918== Conditional jump or move depends on uninitialised value(s)
==10918==    at 0x4005E89: strlen (mac_replace_strmem.c:243)
==10918==    by 0x80B3EFF: ztrdup (string.c:52)
==10918==    by 0x810FA24: bindkey (zle_keymap.c:548)
==10918==    by 0x811123C: add_cursor_key (zle_keymap.c:1253)
==10918==    by 0x8111540: default_bindings (zle_keymap.c:1329)
==10918==    by 0x81110E4: init_keymaps (zle_keymap.c:1192)

There are several more all of which have in common zle_keymap.c:548 or
zle_keymap.c:547

    542     if(!bind || ztrlen(seq) > 1) {
    543         /* key needs to become a prefix if isn't one already */
    544         if(km->first[f]) {
    545             char fs[3];
    546             fs[0] = f;
    547             metafy(fs, 1, META_NOALLOC);
    548             km->multi->addnode(km->multi, ztrdup(fs),
    549                 makekeynode(km->first[f], NULL));
    550             km->first[f] = NULL;
    551         }

Index: Src/Zle/zle_keymap.c
===================================================================
diff -u -r1.19 zle_keymap.c
--- Src/Zle/zle_keymap.c        21 Dec 2010 16:41:16 -0000      1.19
+++ Src/Zle/zle_keymap.c        20 Dec 2011 16:34:32 -0000
@@ -544,6 +544,7 @@
        if(km->first[f]) {
            char fs[3];
            fs[0] = f;
+           fs[1] = 0;
            metafy(fs, 1, META_NOALLOC);
            km->multi->addnode(km->multi, ztrdup(fs),
                makekeynode(km->first[f], NULL));

-- 
Barton E. Schaefer


                 reply	other threads:[~2011-12-20 16:38 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=111220083828.ZM11120@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).