Fix: MXP parser blocked on non-escaped '&' and '<' characters#8274
Fix: MXP parser blocked on non-escaped '&' and '<' characters#8274vadi2 merged 8 commits intoMudlet:developmentfrom
Conversation
|
Hi, I pushed a commit that fixes the issue. Sorry for the inconvenience. Change in Additionally, I added more unit tests to cover all kinds of MXP strings (including this one) and manually tested various games in the default MUD list. |
|
It did work better with StickMUD. Sorting a few things out to determine if they are this PR or another. I made an MXP test room for StickMUD, but noted that StickMUD already was handling those scenarios since it is MXP ready. Reviewing as time permits. Finding the places in the other default MUDs that broke will be a side quest POC as well. |
|
Good with this one @mpconley ? |
|
Once this PR is reviewed, I can move forward with either preparing the groundwork for the mobile version (#8030) or implementing functional tests to prevent regressions. Plenty of opportunities to keep improving from here. Edit : I fixed the merge conflits. |
00e36ca to
ebc3b4b
Compare
|
Looking to find default MUDs that had this issue to test on. Tested 7afba92. This passed my StickMUD test room. The game is very resilient already via its parser: mxp_test_room_results.txt |
|
@taranion have any places to test this? |
|
@mpconley Hm, I fixed my previously broken MXP with & in the output. But I downloaded the Mudlet-4.19.1-testing-pr8274-7afba926-linux-x64.AppImage.tar snapshot and recreated the server bug locally and can confirm that Mudlet deals with it without problems now. |
|
This one may also close #3907, or this plus the other things we've done with MXP for the upcoming release. |

Motivation for adding to Mudlet
This pull request addresses issue #7896.
Problem re-explained
Currently if the MUD game sends a non-escaped "&" or "<" the MXP parser will consider what follows as a "tag" or an "entity" and therefore will not display it on the screen.
Sometimes it would even freeze.
This behavior usually results from the MUD game not escaping characters properly.
Brief overview of PR changes/additions
If a tag (something that starts with '<') is never closed after 3seconds, display the text that follows as raw text.
While looking for a closing '>' if the parser encounters another '<', consider the first '<' as malformed and immediately display the text as raw text.
Tests
Additions 1. and 3. have unit tests.
Addition 2 (the change in TBuffer::translateToPlainText()) currently requires one of the following :
either a manual test :
or
a test that would use a newly created stub of the class TBuffer
(which is currently too dependent on Host* and TConsole*)
or
a functional test (would need to modify the CMakeLists to create a big static lib and link it to the test)
Contact
@spynight on discord or
nicolaskeita2@gmail.com
/claim #7896
Fixes #7896