Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IO.EndOfStreamException: ReadBytesSegment can't read 15 bytes because it would read past the end of the stream #3484

Open
ywm1991 opened this issue May 12, 2023 · 3 comments

Comments

@ywm1991
Copy link

ywm1991 commented May 12, 2023

Describe the bug
Message:Closed connection: connection(2). This can happen if the other side accidentally (or an attacker intentionally) sent invalid data. Reason: System.IO.EndOfStreamException: ReadBytesSegment can't read 15 bytes because it would read past the end of the stream. NetworkReader pos=21 len=24 buffer=52-27-D8-72-AC-7B-5A-40-94-B4-04-01-00-00-00-13-41-10-00-00-00-01-1A-50
at Mirror.NetworkReader.ReadBytesSegment (System.Int32 count) [0x0001b] in D:\work\neonspark\Assets\Plugins\Mirror\Runtime\NetworkReader.cs:168
at Mirror.NetworkReaderExtensions.ReadBytesAndSizeSegment (Mirror.NetworkReader reader) [0x00008] in D:\work\neonspark\Assets\Plugins\Mirror\Runtime\NetworkReaderExtensions.cs:111
at Mirror.GeneratedNetworkCode._Read_Mirror.CommandMessage (Mirror.NetworkReader reader) [0x00032] in :0
at (wrapper delegate-invoke) System.Func2[Mirror.NetworkReader,Mirror.CommandMessage].invoke_TResult_T(Mirror.NetworkReader) at Mirror.NetworkReader.Read[T] () [0x00036] in D:\work\neonspark\Assets\Plugins\Mirror\Runtime\NetworkReader.cs:191 at Mirror.MessagePacking+<>c__DisplayClass6_02[T,C].b__0 (Mirror.NetworkConnection conn, Mirror.NetworkReader reader, System.Int32 channelId) [0x00051] in D:\work\neonspark\Assets\Plugins\Mirror\Runtime\MessagePacking.cs:107

client send command CmdClientToServerSync this function

[IMPORTANT] How can we reproduce the issue, step by step:
Please tell us how to reproduce your issue, STEP BY STEP, with one of our built in examples.
-> Tell us every single click / key press so we can reproduce it
-> If it can't be reproduced with our built in examples, tell us what else to do
-> Explain like we are five

Any bug that can be reproduced, can be fixed.
If we can't reproduce it, we can't fix.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [ Windows, ]
  • Build target: [,standalone]
  • Unity version: [e.g. 2020.3.46]
  • Mirror branch: [e.g. master.67.0.0]

Additional context
Add any other context about the problem here.

@miwarnec
Copy link
Collaborator

@ywm1991 can you provide the command function from the error message so we can reproduce it?

@ywm1991
Copy link
Author

ywm1991 commented Jun 5, 2023

networktransformbase.CmdClientToServerSync this.function

@ywm1991
Copy link
Author

ywm1991 commented Jun 5, 2023

Message:Closed connection: connection(0).channelId:1 This can happen if the other side accidentally (or an attacker intentionally) sent invalid data. Reason: System.IO.EndOfStreamException: ReadBytesSegment can't read 31 bytes because it would read past the end of the stream. NetworkReader pos=49 len=78 buffer=CF-18-13-57-26-82-9B-40-BA-84-02-00-00-00-02-88-27-10-00-00-00-01-A3-B5-10-47-B9-D9-F9-C5-00-00-00-00-00-00-BA-84-02-00-00-00-06-88-27-20-00-00-00-01-00-00-9A-BF-00-A0-97-3F-00-00-00-00-01-00-00-00-80-00-00-00-80-20-6F-79-3F-40-6E-66
at Mirror.NetworkReader.ReadBytesSegment (System.Int32 count) [0x0001b] in D:\work\neonsparkmain\Assets\Plugins\Mirror\Runtime\NetworkReader.cs:173
at Mirror.NetworkReaderExtensions.ReadBytesAndSizeSegment (Mirror.NetworkReader reader) [0x00008] in D:\work\neonsparkmain\Assets\Plugins\Mirror\Runtime\NetworkReaderExtensions.cs:111
at Mirror.GeneratedNetworkCode._Read_Mirror.RpcMessage (Mirror.NetworkReader reader) [0x00032] in :0
at (wrapper delegate-invoke) System.Func2[Mirror.NetworkReader,Mirror.RpcMessage].invoke_TResult_T(Mirror.NetworkReader) at Mirror.NetworkReader.Read[T] () [0x00036] in D:\work\neonsparkmain\Assets\Plugins\Mirror\Runtime\NetworkReader.cs:196 at Mirror.MessagePacking+<>c__DisplayClass6_02[T,C].b__0 (Mirror.NetworkConnection conn, Mirror.NetworkReader reader, System.Int32 channelId) [0x00051] in D:\work\neonsparkmain\Assets\Plugins\Mirror\Runtime\MessagePacking.cs:107

this.error message from networktransformbase.RpcServerToClientSync function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants