By fixing other stuff I came across funny crash in dosbox console, is happens in 0.74 and the same is 4180 svn. I am not sure how much worth it is to fix, well, I put it here, maybe someone will be interested, if I find some free time then I can look patch (if it will not be fixed).
How to reproduce it :
Be in dosbox black console. Press and hold CTRL, with second finger press key 'T' and let duplicate letter to second line or third line. Release 'T' and tap 2-3 times on key 'I'. If it still did not crash then release CTRL and press 'Enter'.
it happens after 82 paragarph signs(ctrl+t) and then searching using the ctrl+I
the log it brings
by gdb the trace is
it seems that the cause of the issue is mask in
(gdb) print mask
$1 = 2147483647
so the issue seems to be around this bit in src/shell/shell_misc.cpp
adding limit to the condition in if (p_completion_start) that check if p_condition_start is in the scope of DOS_PATHLENGTH would be the basic solution though it seems that adding a check if the string is empty would be more comprehensive
Last edit: Dash 2019-04-01
I'll check. thanks for the initial analysis Dash.
I misinterpreted the initial report wrong, I though Bruenor was talking about the console window (on windows) that can be hidden with -noconsole and couldn't reproduce the problem at all.
no problem, it's been awhile since i've touched c++ but i've checked locally to verify that this is the source of the issue, and changing
to
seems to fix the crush and append the search function after the paragraph signs + whatever letter is after them as the code designate in the else case.(DOS_PATHLENGTH being the limit given to the string "mask" which casued the buffer overflow),
Yeah, that is the location where it goes wrong, but your fix is not 100% correct.
As 3 characters are added to the p_completions_start in some cases
so
would be more accurate.
However, I am not sure if using the else for when near the DOS_PATHLENGTH is the right way.
As we would be generating unrelevant results (as mask would only contain "." then). Might be better to not generate a completion_list at all in that case.
Last edit: Qbix 2019-04-02
Thank you