s integer overflow, unsafe cast
This commit is contained in:
1 parent
a24f9f5a5e
commit
ed13020cf3
7 files changed
+28
-23
No files matched your search
@@ -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