]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
Readline-8.3 patch 3: fix crash when interrupting reverse i-search with ^C master
authorChet Ramey <chet.ramey@case.edu>
Wed, 10 Dec 2025 16:36:18 +0000 (11:36 -0500)
committerChet Ramey <chet.ramey@case.edu>
Wed, 10 Dec 2025 16:36:18 +0000 (11:36 -0500)
input.c
isearch.c
patchlevel

diff --git a/input.c b/input.c
index 3383edb678a99593b935ccc5d2f86b869ef45198..838692af684890f18011e3021c58c1779a804b70 100644 (file)
--- a/input.c
+++ b/input.c
@@ -975,11 +975,11 @@ postproc_signal:
         call the application's signal event hook. */
       if (rl_signal_event_hook)
        (*rl_signal_event_hook) ();
-#if defined (READLINE_CALLBACKS)
-      else if (osig == SIGINT && (ostate & RL_STATE_CALLBACK) && (ostate & (RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_NUMERICARG)))
+      /* If the application's SIGINT handler returns, make sure we abort out of
+        searches and numeric arguments because we've freed necessary state. */
+      if (osig == SIGINT && (ostate & (RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_NUMERICARG)))
         /* just these cases for now */
         _rl_abort_internal ();
-#endif
     }
 }
 
index 7b845c20dc7d03808582b6998a1aacb4b4ef695c..6cb1879d2b687062c086c05725ee75789d142916 100644 (file)
--- a/isearch.c
+++ b/isearch.c
@@ -889,12 +889,14 @@ opcode_dispatch:
 int
 _rl_isearch_cleanup (_rl_search_cxt *cxt, int r)
 {
+  RL_UNSETSTATE(RL_STATE_ISEARCH);
+  if (cxt == 0)
+    return (r != 0);
+
+  _rl_iscxt = 0;
   if (r >= 0)
     _rl_isearch_fini (cxt);
   _rl_scxt_dispose (cxt, 0);
-  _rl_iscxt = 0;
-
-  RL_UNSETSTATE(RL_STATE_ISEARCH);
 
   return (r != 0);
 }
index 7cbda82ded86fa174ee44dba637d5fa80815bfdc..ce3e35565330d4faf05e7f91c30ce66182f764fd 100644 (file)
@@ -1,3 +1,3 @@
 # Do not edit -- exists only for use by patch
 
-2
+3