I managed to generate some output that included the sequence ESC ~  
and it cause my tmux server to crash. To reproduce it try this:

     tmux -vvvv -S crash-ESC-tilde new-session "printf '\033~'"

The tail of the server log files includes this:

     input_parse: 'ESC' ground
     input_parse: '~' esc_enter
     fatal: input_parse: No transition from state!

With the following patch, the above command exits in a normal fashion  
and produces the a server log that contains:

     input_parse: 'ESC' ground
     input_parse: '~' esc_enter
     input_esc_dispatch: '~',
     input_esc_dispatch: unknown '~'

---- >8 ----

Subject: [PATCH] input: cover missing ESC } and ESC ~ transitions

Define the transitions for } and ~ in the "esc_enter" state to
prevent the server from exiting when it receives the sequences.

This prevents the loss of all sessions if the user accidentally
generates junk output that includes one of the unhandled sequences.
---
  input.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/input.c b/input.c
index 32e90c8..4e2c23e 100644
--- a/input.c
+++ b/input.c
@@ -385,7 +385,7 @@ ... input_state_esc_enter_table[] = {
        { 0x5f, 0x5f, NULL,               &input_state_apc_string },
        { 0x60, 0x6a, input_esc_dispatch, &input_state_ground },
        { 0x6b, 0x6b, NULL,               &input_state_rename_string },
-       { 0x6c, 0x7c, input_esc_dispatch, &input_state_ground },
+       { 0x6c, 0x7e, input_esc_dispatch, &input_state_ground },
        { 0x7f, 0xff, NULL,               NULL },

        { -1, -1, NULL, NULL }
-- 
1.7.0.4

-- 
Chris

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to