Packet Off-By-One with Architectury API Packets Under Forge
hammy275 opened this issue ยท 1 comments
Notes:
- I haven't tested this under 1.18.2's build, nor under the current branch for 1.19, apologies. If I ever get around to testing them, I'll update this issue.
- This issue does NOT occur under Fabric.
- This issue does NOT occur when VivecraftMod is not installed. It seems to specifically be the combination of Architectury API + VivecraftMod that causes this.
I have not tested a non-Architectury Forge mod at this time.EDIT: Non-architectury Forge mods do NOT have this issue. It's definitely something between the Architectury API and Forge- This issue does not prevent mods from using packets properly; it only seems to cause massive log spam
Reproduction Steps:
- Create a profile with Forge 43.1.7.
- Install Architectury API 6.3.56 and Vivecraft 0.0.12.
- Install any Forge mod that sends packets using Architectury's API. I've created an extremely basic example mod that does this, sending a packet to the server containing the int
32
every tick (then putting said number in chat). - Launch the profile, either in VR or NonVR mode (both modes produce the bug).
- Observe an error similar to the below whenever a packet is received:
java.lang.IndexOutOfBoundsException: readerIndex(58) + length(1) exceeds writerIndex(58): UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 58, widx: 58, cap: 256)
at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) ~[netty-buffer-4.1.77.Final.jar%23107!/:4.1.77.Final]
at io.netty.buffer.AbstractByteBuf.readByte(AbstractByteBuf.java:730) ~[netty-buffer-4.1.77.Final.jar%23107!/:4.1.77.Final]
at net.minecraft.network.FriendlyByteBuf.readByte(FriendlyByteBuf.java:1068) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.network.FriendlyByteBuf.m_130242_(FriendlyByteBuf.java:422) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.network.FriendlyByteBuf.m_130136_(FriendlyByteBuf.java:565) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.network.FriendlyByteBuf.m_130281_(FriendlyByteBuf.java:606) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at dev.architectury.networking.forge.NetworkManagerImpl.lambda$createPacketHandler$7(NetworkManagerImpl.java:120) ~[architectury-6.3.56-forge.jar%23145!/:?]
at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260) ~[eventbus-6.0.3.jar%2379!/:?]
at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252) ~[eventbus-6.0.3.jar%2379!/:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%2379!/:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%2379!/:?]
at net.minecraftforge.network.NetworkInstance.dispatch(NetworkInstance.java:68) ~[forge-1.19.2-43.1.7-universal.jar%23153!/:?]
at net.minecraftforge.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:77) ~[forge-1.19.2-43.1.7-universal.jar%23153!/:?]
at java.util.Optional.map(Optional.java:260) ~[?:?]
at net.minecraftforge.network.NetworkHooks.onCustomPayload(NetworkHooks.java:77) ~[forge-1.19.2-43.1.7-universal.jar%23153!/:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.m_7423_(ServerGamePacketListenerImpl.java:1774) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket.m_5797_(ServerboundCustomPayloadPacket.java:35) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket.m_5797_(ServerboundCustomPayloadPacket.java:8) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.network.protocol.PacketUtils.m_131356_(PacketUtils.java:22) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:157) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:763) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:157) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:131) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:746) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:740) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:116) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:725) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:658) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244) ~[client-1.19.2-20220805.130853-srg.jar%23148!/:?]
at java.lang.Thread.run(Thread.java:833) [?:?]