]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
Readline-8.2 patch 12: prevent infinite recursion if a key sequence is bound to do...
authorChet Ramey <chet.ramey@case.edu>
Sat, 3 Aug 2024 17:27:21 +0000 (13:27 -0400)
committerChet Ramey <chet.ramey@case.edu>
Sat, 3 Aug 2024 17:27:21 +0000 (13:27 -0400)
isearch.c
patchlevel
readline.c

index c2d4d236e9993e8b0fd35e959edf3e38d83e86e3..227b69217a3a48b6b1ef165265e984489abedaec 100644 (file)
--- a/isearch.c
+++ b/isearch.c
@@ -428,7 +428,11 @@ add_character:
        {
          f = cxt->keymap[c].function;
          if (f == rl_do_lowercase_version)
-           f = cxt->keymap[_rl_to_lower (c)].function;
+           {
+             f = cxt->keymap[_rl_to_lower (c)].function;
+             if (f == rl_do_lowercase_version)
+               f = rl_insert;
+           }
        }
 
       if (f == rl_reverse_search_history)
index f01eabb2db51da9271152b27f664fcefce5d6456..0938386741f03aa66ecf8c5f8aea2fa4b8624e17 100644 (file)
@@ -1,3 +1,3 @@
 # Do not edit -- exists only for use by patch
 
-11
+12
index 9d42a8d6d66a50ee741efb883ea64e290a053f42..d649af541e8889901d5533199a2fc327cbb29914 100644 (file)
@@ -899,8 +899,17 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
        {
          /* Special case rl_do_lowercase_version (). */
          if (func == rl_do_lowercase_version)
-           /* Should we do anything special if key == ANYOTHERKEY? */
-           return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
+           {
+             /* Should we do anything special if key == ANYOTHERKEY? */
+             newkey = _rl_to_lower ((unsigned char)key);
+             if (newkey != key)
+               return (_rl_dispatch (newkey, map));
+             else
+               {
+                 rl_ding ();           /* gentle failure */
+                 return 0;
+               }
+           }
 
          rl_executing_keymap = map;
          rl_executing_key = key;
@@ -1109,7 +1118,11 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq)
       type = m[ANYOTHERKEY].type;
       func = m[ANYOTHERKEY].function;
       if (type == ISFUNC && func == rl_do_lowercase_version)
-       r = _rl_dispatch (_rl_to_lower ((unsigned char)key), map);
+       {
+         int newkey = _rl_to_lower ((unsigned char)key);
+         /* check that there is actually a lowercase version to avoid infinite recursion */
+         r = (newkey != key) ? _rl_dispatch (newkey, map) : 1;
+       }
       else if (type == ISFUNC)
        {
          /* If we shadowed a function, whatever it is, we somehow need a