wesnoth / wesnoth

An open source, turn-based strategy game with a high fantasy theme.
https://www.wesnoth.org/
GNU General Public License v2.0
5.53k stars 1.02k forks source link

Client crashes on malformed WML from server #6202

Open Monadic-Cat opened 3 years ago

Monadic-Cat commented 3 years ago

Game and System Information

Describe the bug

If a server sends the Wesnoth client the message [error] with no closing tag, the game closes with no explanation. If the game was run from a shell, this is printed:

terminate called after throwing an instance of 'config::error'
  what():  Missing closing tag for tag [error]
expected at <unknown>:1
opened at <unknown>:1

To Reproduce

Steps to reproduce the behavior:

  1. Have the game connect to a server.
  2. Have the server send [error] with no closing tag.
  3. The game closes silently.

Expected behavior

I would expect the Wesnoth client to display an error message and probably return to the main menu.

Additional Context

I encountered this bug working on an alternative server implementation, when I had it send [error]message="ur banned d00d"[/error] (note the lack of newlines) to try and get the game to print that error message upon trying to connect to my server.

Pentarctagon commented 3 years ago

What's the alternate implementation, out of curiosity?

Monadic-Cat commented 3 years ago

I only just started it, here: https://github.com/Monadic-Cat/wesmaild (not much to see yet). My goal with it is to play Wesnoth games over email.

Pentarctagon commented 3 years ago

Ah, neat. The WML parsing/serializing in rust will be interesting to see, especially since Wesnoth has two implementations of its own (config and simple_wml).