Menu

#47 Internal editor segfaults & disconnects after exiting "Help" screen

1.0.8.x
accepted
None
2024-02-05
2024-01-31
lodger
No

Hello, MBSE Developer Team,

I have found and fixed an error with the 'HelP' window shown in the internal
editor, which causes the editor to crash:

1.) Steps to reproduce:
- Enter a message in the internal editor
- In the editor, press <esc> and then <h> to display the help text window
- Press a key to close the help text window
- Try to continue to edit the message text
-> an error message appears, then the BBS disconnects</h></esc>

2.) Root cause analysis:
- The function "void Full_Help(void)" in fsedit.c utilizes several helper
functions to draw the help-text window. These helper functions access and
manipulate the gobal variables "int Col" and "int Row" causing an overflow
of the "Row" variable. This overflow will lead to a Segfault when "Refresh()"
function is called before resuming editing of the text.

3.) Solution:
- i've added tow local variables "int hc" and "int hr" to the function
"void Full_Help(void)" which are being used to temporary store the original
values if "int Col" and "int Row" at the beginning of the function before
drawing the help-text window. Once this is drawn, "int Col" and "int Row" are
being assigned the original values temporarily stored in "int hc" and
"int hr". That way, the call to "Refresh()" after drawing the help-text window
will no longer crash and operate as intended.

I've attached my fixed function code to this ticket.

Kind regards,
Niels

1 Attachments

Discussion

  • Andrew Leary

    Andrew Leary - 2024-02-05
    • status: open --> accepted
    • assigned_to: Andrew Leary
     
  • Andrew Leary

    Andrew Leary - 2024-02-05

    Thank you for the detailed bug report and fix.

     

Log in to post a comment.