bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crash in rl_prep_terminal() without rl_outstream


From: Nick Black
Subject: crash in rl_prep_terminal() without rl_outstream
Date: Mon, 16 Nov 2020 03:19:35 -0500

readline 6.2 supplied a default stdin for rl_instream if the
latter was NULL at the time rl_prep_terminal() was called. It
does not appear that similar protective measures have been
applied to rl_outstream. This leads to a crash under certain
circumstances.

in my uneducated opinion, it makes sense to apply the following
patch, but i'm sure there are many considerations of which i am
unaware. if this or something like it is *not* to be applied, it
would be nice to call out the need for rl_outstream in the
documentation (unless i missed it).

thanks!

--- rltty.c     2018-09-19 11:19:26.000000000 -0400
+++ rltty.c.new 2020-11-16 03:16:51.311626266 -0500
@@ -606,6 +606,10 @@
   _rl_block_sigint ();
 
   tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
+  if (rl_outstream)
+    {
+      rl_outstream = stdout;
+    }
 
   if (get_tty_settings (tty, &tio) < 0)
     {

-- 
nick black -=- https://www.nick-black.com
to make an apple pie from scratch,
you need first invent a universe.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]