MCHPR / MCHPRS

A multithreaded Minecraft server built for redstone.
MIT License
1.65k stars 73 forks source link

Prevent placement of blocks under the world #37

Closed tyler569 closed 3 years ago

tyler569 commented 3 years ago

Today, using MCHPRS worldedit you can place blocks below the world, but if you do the plot crashes everytime it is loaded, effectively locking players occupying that plot out until it is deleted.

The relevant line appears to be 9: mchprs::world::storage::Chunk::encode_packet at src/world/storage.rs:347:24

which seems to indicate the Chunk format is failing to encode a packet whose data includes blocks whose Y value is less than 0.

There is already a check that blocks are not placed above the world, and in this change I add a check that they are not below the world either.

I tested this to resolve the crash condition when //stack'ing and //set'ing below the world