world: sanity check chunk bit_size, failing earlier

This commit is contained in:
ice_iix 2021-12-30 09:53:22 -08:00
parent 0dad35bed3
commit 86ab59ea9c
1 changed files with 4 additions and 0 deletions

View File

@ -1072,6 +1072,10 @@ impl World {
mappings.insert(i as usize, bl);
}
}
if bit_size > 16 {
// https://wiki.vg/Chunk_Format#Data_structure "This increase can go up to 16 bits per block"...
panic!("load_chunk19_to_117: bit_size={:?} > 16", bit_size);
}
let bits = LenPrefixed::<VarInt, u64>::read_from(&mut data)?.data;
let padded = self.protocol_version >= 736;