Skip to content

Windows IL2CPP builds breaking FishNet version check #1043

@maxkratt

Description

@maxkratt

Copied from the report by Skrill on Discord:

Hello, I'd like to report a bug that's been causing problems with Windows IL2CPP builds.

The problem I was facing is, whenever I try to start a server on a Windows IL2CPP build, I get:

 Connection Id [0] Address [127.0.0.1] has been kicked for being on FishNet version . Server version is 4.7.2. 

I did some debugging to find out why the FishNet version string is empty on builds.

After some debugging:

Assets/FishNet/Runtime/Serializing/Reader.cs has a hand-patched ZigZagDecode that replaces the original ulong sign = value << 63; if (sign > 0) ... form with the canonical (value >> 1) ^ (ulong)(-(long)(value & 1)). The original form is miscompiled by IL2CPP on Windows StandaloneWindows64 player builds — the branch always wins, so positive varint values decode as negative (e.g. 10 → -6).

symptom was FishNet kicking every connecting client with "FishNet version . Server version is 4.7.2." — the empty version string came from ReadStringAllocated's length read being negative, which tripped IsPossibleAllocationAttack and returned string.Empty. Same bug silently corrupts every other length-prefixed read (collections, RPC args, etc.) but the version handshake is the first place it surfaces because it kicks. Works in editor (Mono), fails in IL2CPP player builds. ZigZagEncode uses >> 63 instead of << 63 and isn't affected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions