LiteLDev/LiteLoader.NET

Crash when using Packet.Read(ReadOnlyBinaryStream)

S3v3Nice opened this issue · 1 comments

A crash occurs when trying to read ReadOnlyBinaryStream into a packet:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at <Module>.Packet.read(Packet*, ReadOnlyBinaryStream*)
   at MC.Packet.Read(MC.ReadOnlyBinaryStream)

Example code that causes an error:

BinaryStream stream = new BinaryStream();
Packet packet = MinecraftPackets.CreatePacket(MinecraftPacketId.PlayerSkin);
packet.Read(stream);
Pd233 commented

Maybe the std::shared_ptr is destructed.