Re: multidefine segfault

From: Laurent Bercot <>
Date: Tue, 11 Apr 2017 22:00:45 +0000

>Out of curiousity, what kind of bug was it in terms of what was
>happening to the memory?

  Out of bounds access. The -r option code does "array[i-1]", and i may
zero when the key block is empty, which should never happen but was not
properly checked. So your use case triggered "array[(unsigned int)-1]",
which hits a place in memory it definitely should not. :)

>Also, in the above example, I would like to feed a three word input
>(string or line in regular terminology?) to the first multidefine, and
>extract the two of the words out of $msg with the second multidefine,
>but it gives me an unquoted argument error. What am I doing wrong, or
>what's the correct way to do this? I am stuck...

  You only need one invocation.

pipeline { echo one two three }
withstdinas -n line
importas -u line line
multidefine $line { cmd key val }
echo $key $val

  will print "two three".

Received on Tue Apr 11 2017 - 22:00:45 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC