fix some AddressSanitizer issues

This commit is contained in:
nillerusr
2022-06-14 13:16:08 +03:00
parent a0e05d885a
commit 29db778997
8 changed files with 26 additions and 26 deletions
+3 -2
View File
@@ -543,7 +543,7 @@ struct AsyncCaptionData_t
data->m_nBlockNum = params.blocktoload;
data->m_nFileIndex = params.fileindex;
data->m_nBlockSize = params.blocksize;
data->m_pBlockData = new byte[ data->m_nBlockSize ];
data->m_pBlockData = new byte[ data->m_nBlockSize * sizeof(ucs2) ];
return data;
}
@@ -2027,6 +2027,7 @@ public:
if ( entry.blockNum != nBlockNum )
continue;
#ifdef WIN32
const wchar_t *pIn = ( const wchar_t *)&pData->m_pBlockData[ entry.offset ];
caption->stream = new wchar_t[ entry.length >> 1 ];
@@ -2034,7 +2035,7 @@ public:
#else
// we persist to disk as ucs2 so convert back to real unicode here
caption->stream = new wchar_t[ entry.length ];
V_UCS2ToUnicode( (ucs2 *)&pData->m_pBlockData[ entry.offset ], caption->stream, entry.length*sizeof(wchar_t) );
V_UCS2ToUnicode( (ucs2 *)&pData->m_pBlockData[ entry.offset ], caption->stream, entry.length << 1 );
#endif
}
}
+1 -1
View File
@@ -1014,7 +1014,7 @@ bool CParticleEffectBinding::RecalculateBoundingBox()
CEffectMaterial* CParticleEffectBinding::GetEffectMaterial( CParticleSubTexture *pSubTexture )
{
// Hash the IMaterial pointer.
unsigned long index = (((unsigned long)pSubTexture->m_pGroup) >> 6) % EFFECT_MATERIAL_HASH_SIZE;
unsigned int index = (((unsigned int)pSubTexture->m_pGroup) >> 6) % EFFECT_MATERIAL_HASH_SIZE;
for ( CEffectMaterial *pCur=m_EffectMaterialHash[index]; pCur; pCur = pCur->m_pHashedNext )
{
if ( pCur->m_pGroup == pSubTexture->m_pGroup )