Patbox / PolyFactory

A server side tech mode with storage, crafting and utility tech™
GNU Lesser General Public License v3.0
33 stars 5 forks source link

Infinite gear ratios allow for crashing clients by overflowing java 64 bit long #14

Closed alfonsojon closed 4 months ago

alfonsojon commented 4 months ago

By combining multiple gears, one can increase the velocity to the degree that it will instantly crash a server should an entity touch a conveyor belt powered by it. This can be abused to crash servers, ban players, and cause extreme lag.

I'd like to propose that the mod implements some form of torque as a friendly way to prevent this from happening, similar to a redstone cap of 15 blocks, this would ensure that a necessary amount of torque must be met to power a device. This will prevent these types of gear reductions from working as they generate impossibly low amounts of torque in real life.

Here's a good video demonstrating this principle in real life using Lego - https://youtu.be/QwXK4e4uqXY

I'd also like to suggest that there be some theoretical cap on speed/velocity to protect against edge cases.

2024-04-14_12 12 05

net.minecraft.class_148: Ticking player
        at net.minecraft.class_3222.method_14226(class_3222.java:583) ~[server-intermediary.jar:?]
        at net.minecraft.class_3244.method_18784(class_3244.java:257) ~[server-intermediary.jar:?]
        at net.minecraft.class_2535.method_10754(class_2535.java:379) ~[server-intermediary.jar:?]
        at net.minecraft.class_3242.method_14357(class_3242.java:176) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:959) ~[server-intermediary.jar:?]
        at net.minecraft.class_3176.method_3813(class_3176.java:283) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:845) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:683) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) ~[server-intermediary.jar:?]
        at java.lang.Thread.run(Unknown Source) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Start element (9223367638808264704) is larger than end element (-9223372036854775808)
        at it.unimi.dsi.fastutil.longs.LongAVLTreeSet$Subset.<init>(LongAVLTreeSet.java:1080) ~[fastutil-8.5.12.jar:?]
        at it.unimi.dsi.fastutil.longs.LongAVLTreeSet.subSet(LongAVLTreeSet.java:1047) ~[fastutil-8.5.12.jar:?]
        at net.minecraft.class_5573.method_31777(class_5573.java:57) ~[server-intermediary.jar:?]
        at me.jellysquid.mods.lithium.common.world.WorldHelper.getEntitiesOfClassGroup(WorldHelper.java:68) ~[lithium-fabric-mc1.20.4-0.12.1.jar:?]
        at me.jellysquid.mods.lithium.common.world.WorldHelper.getEntitiesForCollision(WorldHelper.java:45) ~[lithium-fabric-mc1.20.4-0.12.1.jar:?]
        at me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions$1$1.computeNext(LithiumEntityCollisions.java:106) ~[lithium-fabric-mc1.20.4-0.12.1.jar:?]
        at me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions$1$1.computeNext(LithiumEntityCollisions.java:94) ~[lithium-fabric-mc1.20.4-0.12.1.jar:?]
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:145) ~[guava-32.1.2-jre.jar:?]
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:140) ~[guava-32.1.2-jre.jar:?]
        at me.jellysquid.mods.lithium.common.entity.LithiumEntityCollisions.getEntityWorldBorderCollisions(LithiumEntityCollisions.java:74) ~[lithium-fabric-mc1.20.4-0.12.1.jar:?]
        at net.minecraft.class_1297.lithiumCollideMultiAxisMovement(class_1297.java:12929) ~[server-intermediary.jar:?]
        at net.minecraft.class_1297.redirect$dha000$lithium$adjustMovementForCollisionsGetEntitiesLater(class_1297.java:12881) ~[server-intermediary.jar:?]
        at net.minecraft.class_1297.method_17835(class_1297.java:1021) ~[server-intermediary.jar:?]
        at net.minecraft.class_1297.method_5784(class_1297.java:707) ~[server-intermediary.jar:?]
        at net.minecraft.class_1309.method_26318(class_1309.java:2339) ~[server-intermediary.jar:?]
        at net.minecraft.class_1309.method_6091(class_1309.java:2259) ~[server-intermediary.jar:?]
        at net.minecraft.class_1657.method_6091(class_1657.java:1620) ~[server-intermediary.jar:?]
        at net.minecraft.class_3222.method_6091(class_3222.java:1128) ~[server-intermediary.jar:?]
        at net.minecraft.class_1309.method_6007(class_1309.java:2743) ~[server-intermediary.jar:?]
        at net.minecraft.class_1657.method_6007(class_1657.java:582) ~[server-intermediary.jar:?]
        at net.minecraft.class_1309.method_5773(class_1309.java:2446) ~[server-intermediary.jar:?]
        at net.minecraft.class_1657.method_5773(class_1657.java:284) ~[server-intermediary.jar:?]
        at net.minecraft.class_3222.method_14226(class_3222.java:519) ~[server-intermediary.jar:?]
        ... 9 more
alfonsojon commented 4 months ago

2024-04-14_12 20 44