Long text in the editor can crash the game, and builders' edits leak memory

Open
#532 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@drelidan7 is already working on this.

Since Oct 28, 2026.

Assessment

This issue has not been assessed yet.

Description

bug
What could go wrong for players?

The game's text editor is used for letters, board posts, character descriptions, notes and everything builders write in the mob, room, zone and script editors. It reads or writes memory it doesn't own in several places:

  • Each time a text grows past the space set aside for it, the editor reads past the end of the old space.
  • Replacing words with %s builds the new text in a fixed space of about 8,000 characters without checking that it fits, so a replacement that makes the text longer than that writes past it.
  • Typing %r, %l or %f before the first line of a letter, after something else was written earlier on the same connection, reads text that isn't there.
  • A page of text too long for the space the game uses to show it writes past that space.

Any of these can crash the game, restarting it and disconnecting everyone.

Notes and letters also ignore their length limits. A note is meant to hold up to 1,000 characters and a letter up to 4,000, but both can run to almost 8,000. write tells the writer to end the note with @, which the editor adds as text instead, and a missing pen is reported as missing paper.

In the builders' editors, every edit of a mob's, room's, zone's or script's text leaves the old text behind in the server's memory. Saving a room into the world, removing an exit, and closing the room or zone editor leave more behind. None of it is reused, so the server's memory grows with every edit until the next restart.

When can it happen?
  • A player writes a letter, a board post or their description long enough to need more room.
  • A player, immortal or builder uses %s on a long text.
  • A player starting a letter types %r, %l or %f before the first line.
  • A player is shown a very long page of text.
  • A builder edits mob, room, zone or script text, saves a room, removes an exit, or closes the room or zone editor.
Has it been seen on the live game?

Not seen yet, found by testing tools or code review

What will players notice once it is fixed?
  • A note holds at most 1,000 characters and a letter at most 4,000. A line or %s that would go past the limit is refused with a message, and the text is kept as it was.
  • Any other text is refused in the same way once it would pass about 7,900 characters, the most the editor keeps, instead of being cut off when it is finished.
  • write says to end the note with %e, and a missing pen is named as the pen.
  • %s no longer adds a blank line to the text.
  • A very long page is shown in parts.
  • Builders edit, save and close as before.
Anything else?

This is one of several issues under the effort to remove every memory error from the game.

Dominant language
C++
Stars
3
Forks
4
Avg merge
18h 36m
Merged PRs (30d)
87

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from returnoftheshadow/RotS_Live

All issues in returnoftheshadow/RotS_Live

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.