Master server accidental pseudo region locking because of float.Parse culture variance #11

Closed
opened 2025-10-27 13:13:24 -04:00 by VIA256 · 1 comment
Owner

yesterday I had noticed in the lobby that there was "1 person online" but "0 people in my version"
I was on 2.22 so I assumed they were on 2.3 so I changed the game version accordingly but to no avail
someone was connected to the masterserver but apparently was not in either version 2.22 or 2.3

this morning I checked the master server log from the previous day and stumbled upon a player joining with this info in the WorldDesc field:
c=v=2,3;w=Freestyle;p=Rafael–;u=http://gitea.moe/lamp/whirlds/raw/branch/master/marsxplr/Freestyle/Whirld.utw

see that? the player was indeed not on 2.22 or 2.3, but rather "2,3"
so I'm guessing that what happened is this player is on some non-english locale,
and when the runtime was told to turn a float into a string, it acted accordingly to Culture info and used a comma instead of a dot.

I guess this wasn't noticed before because
A: if a float is represented with a comma, it is also parsed with a comma. no problem!
B: the master server doesn't care if the game version is parseable as a float (in my locale) because to it, its just another string

thus, region locking based on the user's locale or more specifically how their locale represents floats.

this can be fixed by specifying the CultureInfo as one in particular when sending strings of float values to the master server,
or more ideally, any instance of us turning a float into a string and are sending it to a 3rd party that isn't guaranteed to have our same CultureInfo.

yesterday I had noticed in the lobby that there was "1 person online" but "0 people in my version" I was on 2.22 so I assumed they were on 2.3 so I changed the game version accordingly but to no avail someone was connected to the masterserver but apparently was not in either version 2.22 or 2.3 this morning I checked the master server log from the previous day and stumbled upon a player joining with this info in the WorldDesc field: `c=v=2,3;w=Freestyle;p=Rafael–;u=http://gitea.moe/lamp/whirlds/raw/branch/master/marsxplr/Freestyle/Whirld.utw` see that? the player was indeed not on 2.22 or 2.3, but rather "2,3" so I'm guessing that what happened is this player is on some non-english locale, and when the runtime was told to turn a float into a string, it acted accordingly to Culture info and used a comma instead of a dot. I guess this wasn't noticed before because A: if a float is represented with a comma, it is also parsed with a comma. no problem! B: the master server doesn't care if the game version is parseable as a float (in my locale) because to it, its just another string thus, region locking based on the user's locale or more specifically how their locale represents floats. this can be fixed by specifying the CultureInfo as one in particular when sending strings of float values to the master server, or more ideally, any instance of us turning a float into a string and are sending it to a 3rd party that isn't guaranteed to have our same CultureInfo.
Author
Owner

ok so actually this issue will resolve itself anyway once the fix for this other issue is put in place.
so I'm closing

ok so actually this issue will resolve itself anyway once the fix for [this other issue](https://gitea.moe/VIA256/marsxplr-decomp/issues/12) is put in place. so I'm closing
Sign in to join this conversation.
No description provided.