{"action":"created","issue":{"url":"https://api.github.com/repos/Return-To-The-Roots/s25client/issues/867","repository_url":"https://api.github.com/repos/Return-To-The-Roots/s25client","labels_url":"https://api.github.com/repos/Return-To-The-Roots/s25client/issues/867/labels{/name}","comments_url":"https://api.github.com/repos/Return-To-The-Roots/s25client/issues/867/comments","events_url":"https://api.github.com/repos/Return-To-The-Roots/s25client/issues/867/events","html_url":"https://github.com/Return-To-The-Roots/s25client/issues/867","id":356306282,"node_id":"MDU6SXNzdWUzNTYzMDYyODI=","number":867,"title":"Crash when selecting Hard AI in a lobby","user":{"login":"Peuc","id":1884558,"node_id":"MDQ6VXNlcjE4ODQ1NTg=","avatar_url":"https://avatars0.githubusercontent.com/u/1884558?v=4","gravatar_id":"","url":"https://api.github.com/users/Peuc","html_url":"https://github.com/Peuc","followers_url":"https://api.github.com/users/Peuc/followers","following_url":"https://api.github.com/users/Peuc/following{/other_user}","gists_url":"https://api.github.com/users/Peuc/gists{/gist_id}","starred_url":"https://api.github.com/users/Peuc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Peuc/subscriptions","organizations_url":"https://api.github.com/users/Peuc/orgs","repos_url":"https://api.github.com/users/Peuc/repos","events_url":"https://api.github.com/users/Peuc/events{/privacy}","received_events_url":"https://api.github.com/users/Peuc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-02T19:06:32Z","updated_at":"2018-09-03T16:54:08Z","closed_at":null,"author_association":"NONE","body":"In a lobby, when the player chooses what AIs to play with, the game crashes when selecting Hard AI.\r\n\r\nThe display of the Hard AI Rank (1337) triggers the assert in glArchivItem_Font.cpp:215. After some testing, any rank bigger than 999 crashes here.\r\n\r\nHere is a backtrace:\r\n```Thread 1 \"s25client\" received signal SIGTRAP, Trace/breakpoint trap.\r\n0x0000555555c5668c in glArchivItem_Font::Draw (this=0x555558512200, pos=..., text=\"1\\342\\063\\063\\067\", format=10, color=4294967040, length=0, maxWidth=65535, end=\"...\") at /home/peuc/Developpement/s25client/src/ogl/glArchivItem_Font.cpp:215\r\n215         RTTR_Assert((isValidUTF8(text)));\r\n(gdb) bt\r\n#0  0x0000555555c5668c in glArchivItem_Font::Draw (this=0x555558512200, pos=..., text=\"1\\342\\063\\063\\067\", format=10, color=4294967040, length=0, maxWidth=65535, end=\"...\") at /home/peuc/Developpement/s25client/src/ogl/glArchivItem_Font.cpp:215\r\n#1  0x0000555555de1b74 in ctrlVarDeepening::DrawContent (this=0x55555684b5d0) at /home/peuc/Developpement/s25client/src/controls/ctrlVarDeepening.cpp:30\r\n#2  0x0000555555dc6fec in ctrlDeepening::Draw_ (this=0x55555684b5d0) at /home/peuc/Developpement/s25client/src/controls/ctrlDeepening.cpp:31\r\n#3  0x0000555555d5dd07 in Window::Draw (this=0x55555684b5d0) at /home/peuc/Developpement/s25client/src/Window.cpp:51\r\n#4  0x0000555555d61064 in Window::DrawControls (this=0x555558769a10) at /home/peuc/Developpement/s25client/src/Window.cpp:630\r\n#5  0x0000555555dca8b4 in ctrlGroup::Draw_ (this=0x555558769a10) at /home/peuc/Developpement/s25client/src/controls/ctrlGroup.cpp:32\r\n#6  0x0000555555d5dd07 in Window::Draw (this=0x555558769a10) at /home/peuc/Developpement/s25client/src/Window.cpp:51\r\n#7  0x0000555555d61064 in Window::DrawControls (this=0x5555567a58a0) at /home/peuc/Developpement/s25client/src/Window.cpp:630\r\n#8  0x0000555555b8c08f in Desktop::Draw_ (this=0x5555567a58a0) at /home/peuc/Developpement/s25client/src/desktops/Desktop.cpp:56\r\n#9  0x0000555555d5dd07 in Window::Draw (this=0x5555567a58a0) at /home/peuc/Developpement/s25client/src/Window.cpp:51\r\n#10 0x0000555555b7dd3e in WindowManager::Draw (this=0x5555564fc970) at /home/peuc/Developpement/s25client/src/WindowManager.cpp:80\r\n#11 0x0000555555b546f2 in GameManager::Run (this=0x5555564fc6e0) at /home/peuc/Developpement/s25client/src/GameManager.cpp:164\r\n#12 0x0000555555b43320 in RunProgram (options=...) at /home/peuc/Developpement/s25client/src/s25client/s25client.cpp:392\r\n#13 0x0000555555b4380e in main (argc=1, argv=0x7fffffffe8d8) at /home/peuc/Developpement/s25client/src/s25client/s25client.cpp:447\r\n```\r\n\r\nSystem is an up-to-date Archlinux. From what I've been told, Windows nightlies as distributed on official website aren't affected."},"comment":{"url":"https://api.github.com/repos/Return-To-The-Roots/s25client/issues/comments/418161075","html_url":"https://github.com/Return-To-The-Roots/s25client/issues/867#issuecomment-418161075","issue_url":"https://api.github.com/repos/Return-To-The-Roots/s25client/issues/867","id":418161075,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODE2MTA3NQ==","user":{"login":"Flamefire","id":309017,"node_id":"MDQ6VXNlcjMwOTAxNw==","avatar_url":"https://avatars2.githubusercontent.com/u/309017?v=4","gravatar_id":"","url":"https://api.github.com/users/Flamefire","html_url":"https://github.com/Flamefire","followers_url":"https://api.github.com/users/Flamefire/followers","following_url":"https://api.github.com/users/Flamefire/following{/other_user}","gists_url":"https://api.github.com/users/Flamefire/gists{/gist_id}","starred_url":"https://api.github.com/users/Flamefire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flamefire/subscriptions","organizations_url":"https://api.github.com/users/Flamefire/orgs","repos_url":"https://api.github.com/users/Flamefire/repos","events_url":"https://api.github.com/users/Flamefire/events{/privacy}","received_events_url":"https://api.github.com/users/Flamefire/received_events","type":"User","site_admin":false},"created_at":"2018-09-03T16:54:08Z","updated_at":"2018-09-03T16:54:08Z","author_association":"MEMBER","body":"It is related to the current locale: `text=\"1\\342\\063\\063\\067\"` -> `\"1.337\"` but the dot is some special character which is (obviously) not UTF8. It might be a [zero width non joiner](http://www.fileformat.info/info/unicode/char/200c/index.htm) which is `\\342, \\200, \\214` in UTF-8 but only the first byte got included but that would be strange.\r\n\r\nAll we are doing there is something like:\r\n\r\n```\r\n::setlocale(LC_ALL, \"some_locale\");\r\nstd::stringstream str;\r\nstr << 1337;\r\nreturn str.str();\r\n```\r\n\r\nMaybe you can test this in an example application with your compiler and examine what the result is. The exact bytes and the length of the string will be interesting."}}
{"actor":{"display_login":"Flamefire"}}