View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011813 | Dwarf Fortress | Dwarf Mode -- Interface, Announcements | public | 2021-10-05 06:39 | 2023-11-24 09:49 |
Reporter | Bumber | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 0.47.05 | ||||
Summary | 0011813: '&' in nickname messes with announcement text | ||||
Description | It looks like the announcement and report code uses '&' as an escape sequence. Putting "&r" in a dwarf's nickname or profession will split the announcement at that point and continue the rest two lines down. In other combinations, the '&' will display, but the next character in the string will be ignored. '&' in user text needs to be sanitized to "&&" at some point before ending up in an announcement. | ||||
Tags | No tags attached. | ||||
|
There's also an issue in the related code where use of enough ampersands will cause the line to be cut at the wrong index, deleting text. I set custom professions on my sparring dwarves as "&&aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&" and "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&". gamelog.txt shows: "The &&aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa& strikes at the &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& but the shot is blocked!" Sparring report shows: "The &aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&&&&&&&&&&&&&&&&&&but the shot is blocked!" |
|
(There's also a hypothetical crash that could occur if the index to cut the line at underflows as a result of the above, but you'd need 71+ consecutive characters without a space on the smallest grid size of 80.) |
|
So, the announcement system was redone for v50. The issue in the above comments was fixed. The underlying issue with sanitizing input remains, unfortunately. You can use '[' in nicknames and profession to pass in tokens to the markup text box parser (used by popup/mega announcements, legends mode, etc.) For example, nicknaming a dwarf "[C:4:0:0]Urist" will turn "Urist" and all following text in the text box red until something resets the color. The regular announcement text isn't parsed, so the solution isn't as simple as replacing "[" with "[[", or else you'll get "[[C:4:0:0]]Urist, Swordsdwarf has bestowed" everywhere outside the popup. Disallowing '[' in nicknames might be too restrictive. |