This PR implements an automatic detection and recovery system for malformed MXP (Mud eXtension Protocol) parsing issues that cause screen output to freeze, addressing GitHub issue #7896.
MUDs often send improperly formatted MXP tags with unescaped characters (<
, >
, &
) that cause Mudlet’s MXP parser to get stuck in infinite loops, freezing screen output. This particularly affects new players connecting to MUDs with problematic MXP implementations.
if (!mMxpTagBuilder.accept(ch) && mMxpTagBuilder.isInsideTag() && !mMxpTagBuilder.hasTag()) {
mTagStuckCounter++;
mProblematicContent += ch;
if (mTagStuckCounter > 1000) {
// Trigger recovery mechanism
}
}
The recovery system integrates into the main MXP processing loop in TBuffer.cpp
, checking for stuck parsing and presenting the recovery dialog when issues are detected.
Tested with various malformed MXP scenarios:
<
and >
characters in ASCII art<font color=red
without closing >
)https://github.com/user-attachments/assets/d4a51836-0606-48b0-a228-a3a2f85a0969
This change particularly benefits new players who encounter MUDs with problematic MXP implementations, preventing the frustrating experience of frozen screen output that could drive them away from the game.
Fixes #7896 - Detect MXP issues and offer self-healing options
/claim #7896
Rishi Mondal
@MAVRICK-1
Mudlet
@Mudlet