irssi/irssi — pull request #49 by dgl (2014-06-19 02:18:03+00:00)
Title: Move PUTBACK to within the scope which uses the stack

PUTBACK was being called even for the error case, because the side
effect of emitting the "script error" signal can involve running Perl
code (Irssi:core::destroy) the stack can be reallocated. This results in
the perl stack being corrupted (although as it's use of freed memory the
crash is not always instant).

Reproducing this is pretty hard. Something like two scripts in ~/.irssi/scripts/autorun:

first.pl

use IO::Socket;
use This::doesn't::exist;

second.pl

1;

And then running Irssi under valgrind may show errors or crash before this fix.