Closed fletcherm closed 6 months ago
I was able to replicate this locally, looking into it!
The issue appeared to be in this code here:
This routine loads commands to parse into a string and uses SKPWRD
and SKPWHT
to look through the string using SAMETO
to compare it to the command the user entered to get the help topic to load.
This string gets loaded to an allocated memory address and in very specific scenarios, if the end of the string ended at 0xFFFF
, it would cause SKPWRD
to result in the above logic to loop infinitely because the terminating \0
was at 0xFFFF
which the internal loop would never reach because the loop evaluated < ushort.MaxValue
when it should evaluate <= ushort.MaxValue
I'm writing Unit Tests for both SKPWHT
and SKPWRD
as well as writing a Helper Method that will help test for this scenario where if I want to allocate the string HELLO\0
, it will allocate it at 0xFFF9
allowing us to test for this scenario where the final \0
is at offset 0xFFFF
as there might be some other methods that use similar logic.
Module Information
Describe the bug
Running the
help exp
command can occasionally cause the emulator to appear like it is hung. It pegs the CPU at 100% and is no longer usable until restarted.To Reproduce
This was first found by bad luck via the very occasional use of the
help exp
command. But to easily reproduce it:help exp^M
.Expected behavior
The board should never hang from this command.
Additional info
help
commandsstat
- which displays your character stat sheetexp
- this is different thanhelp exp
.exp
shows your current exp and remaining to level, vs.help exp
which shows your exp tables.Software Information: