You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tputs is called by _rl_clear_to_eol where _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_eol is called from display_manager::display. Which, at the very start creates a preserve_window_scroll_position object that sets _rl_term_clreol to nullptr.
Once the preserve_window_scroll_position is deleted, the _rl_term_clreol value 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.
The text was updated successfully, but these errors were encountered:
SkyLined
changed the title
NULL ptr crash when inputting enough chars to scrolls window horizontally
NULL ptr crash when inputting enough chars to wrap line when window can scrolls horizontally
Feb 7, 2025
SkyLined
changed the title
NULL ptr crash when inputting enough chars to wrap line when window can scrolls horizontally
NULL ptr crash when inputting enough chars to wrap line when window can scroll horizontally
Feb 7, 2025
Confirmed. Thanks for reporting this. There are many ways to hit the crash when the console window width is smaller than the console screen buffer width.
This is a regression caused by some refactoring in eb37b0e in Nov 2024.
Steps to reproduce
Configure cmd.exe to run in Windows Console Host
Run cmd.exe
Make sure the window can scroll horizontally:
110
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.
tputs
is called withs == NULL
.tputs
is called by_rl_clear_to_eol
where_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_eol
is called fromdisplay_manager::display
. Which, at the very start creates apreserve_window_scroll_position
object that sets_rl_term_clreol
tonullptr
.Once the
preserve_window_scroll_position
is deleted, the_rl_term_clreol
value 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.The text was updated successfully, but these errors were encountered: