-
Notifications
You must be signed in to change notification settings - Fork 190
Description
Steps to reproduce
-
Configure cmd.exe to run in Windows Console Host
-
Run cmd.exe
-
Make sure the window can scroll horizontally:
- Click the icon in the console window title bar
- Select Properties
- Under Screen Buffer Size for Width enter
110 - Under Window Size for Width enter
100
(The buffer size needs to be larger than the window size)
-
Type characters (e.g. "AAAAAA...") until the end of the window so it scrolls horizontally.
-
Continue to type characters (e.g. "AAAAAA...") until the end of the line so the line wraps.
-
Observe clink crashing because of a NULL ptr in
tputs.
Basic analysis
I am not familiar with the code, so this may be wrong.
-
tputsis called withs == NULL. -
tputsis called by_rl_clear_to_eolwhere_rl_term_clreol == NULL.
(There is an assert to detect this but that's not in the release version and would also have caused a crash.) -
_rl_clear_to_eolis called fromdisplay_manager::display. Which, at the very start creates apreserve_window_scroll_positionobject that sets_rl_term_clreoltonullptr.
Once thepreserve_window_scroll_positionis deleted, the_rl_term_clreolvalue will be reset to its original value. However, the code does not delete the object before calling_rl_clear_to_eol.
Other possible issues
It appears there other other locations in the code where a preserve_window_scroll_position object is created and _rl_clear_to_eol is called before the object is destroyed, which would cause similar issues.