Openrct2: Crash if try to rename Air Powered Vertical Coaster in CJK

Created on 14 Mar 2021  ยท  3Comments  ยท  Source: OpenRCT2/OpenRCT2


OS: Windows 10
Version: 0.3.3
Commit/Build: 72b6160


When I try to rename Air Powered Vertical Coaster(์—์–ด ํŒŒ์›Œ๋“œ ๋ฒ„ํ‹ฐ์ปฌ ์ฝ”์Šคํ„ฐ) in CJK language, it crashes.
Maybe @AaronVanGeffen can reproduce it.

It is possible if I (1) change language into English, (2) rename it (3) and re-change into Korean again

Steps to reproduce:

  1. Change language into CJK, in my case, Korean.
  2. Build an Air Powered Vertical Coaster as default name
  3. Check that its name is default one (eg. ์—์–ด ํŒŒ์›Œ๋“œ ๋ฒ„ํ‹ฐ์ปฌ ์ฝ”์Šคํ„ฐ 1 in Korean)
  4. Try to rename it
bug crash

All 3 comments

It doesn't crash for me, it freezes.

Also, my debugger points to Drawing.String.cpp:843 instead of 191.

The problem might be that it tries to truncate the string to 32 bytes in TextInput.cpp:

    void SetText(std::string_view text, size_t maxLength)
    {
        _buffer = text;
        _buffer.resize(maxLength);
        _maxInputLength = maxLength;
        gTextInput = context_start_text_input(_buffer.data(), maxLength);
    }

But by doing so, it lands in the middle of a UTF-8 sequence. (EC 8A A4 gets truncated to EC 8A).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Xaroth picture Xaroth  ยท  3Comments

Nubbie picture Nubbie  ยท  3Comments

nuclearslurpee picture nuclearslurpee  ยท  3Comments

Ryder17z picture Ryder17z  ยท  3Comments

qwertychouskie picture qwertychouskie  ยท  3Comments