mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-03 03:24:29 +00:00
s integer overflow, unsafe cast
This commit is contained in:
@@ -80,7 +80,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
|
||||
{
|
||||
// 4jcraft fixed cast from int to int64 and taking the mask of the upper bits
|
||||
// and cast to unsigned
|
||||
__int64 index = ((uint64_t)(uint32_t)(x) << 32) | (((uint64_t)(uint32_t)(z)));
|
||||
uint64_t index = ((uint64_t)(uint32_t)(x) << 32) | (((uint64_t)(uint32_t)(z)));
|
||||
|
||||
AUTO_VAR(it, m_entityData.find(index));
|
||||
if(it != m_entityData.end())
|
||||
@@ -237,7 +237,8 @@ void McRegionChunkStorage::saveEntities(Level *level, LevelChunk *levelChunk)
|
||||
{
|
||||
#ifdef SPLIT_SAVES
|
||||
PIXBeginNamedEvent(0,"Saving entities");
|
||||
__int64 index = ((__int64)(levelChunk->x) << 32) | (((__int64)(levelChunk->z))&0x00000000FFFFFFFF);
|
||||
// 4j added cast to unsigned and changed index to u
|
||||
uint64_t index = ((uint64_t)(uint32_t)(levelChunk->x) << 32) | (((uint64_t)(uint32_t)(levelChunk->z)));
|
||||
|
||||
delete m_entityData[index].data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user