mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 01:39:36 +00:00
fix some AddressSanitizer issues
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user