Subject: Segfault with sed 4.3

From: "S. Gilles" <[email-masked]>
Date: Sun, 8 Jan 2017 00:07:58 -0500

Hi,

I have a reliable segfault with (vanilla) sed 4.3 which does not appear
on (vanilla) 4.2.2. I've pared it down from the ./configure script (for
sed itself) to short working example, but I'm not sure if it's minimal.

I should note that this originally showed up on a bit of a snowflake
machine (armv7a+musl) when attempting to use any sort of nontrivial
./configure, but the my working example triggers the issue on a
boring amd64+glibc machine, even though that machine has no problem
./configure-ing all sorts of things.  That could mean my example is
doing bad things that the original case didn't, in which case I'll try
to cook up another example. Without further ado (please excuse the UUoc):

----8<--------8<--------8<--------8<--------8<--------8<----
#!/bin/sh

# Or wherever you have it
sed="/bin/sed"

cat <<EOF > input.txt
1
1
\$LINENO \$LINEN
2
EOF

cat input.txt |
"${sed}" 's/\$LINENO.*/&-/
t lineno
:lineno
N
:loop
s/\$LINENO\(.*\n\)/\1/' > out.txt
----8<--------8<--------8<--------8<--------8<--------8<----

-- 
S. Gilles