2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-28 13:02:13 +01:00

engine: fix crash when reading GoldSrc hashpaks

This commit is contained in:
Alibek Omarov 2022-09-19 06:02:41 +03:00
parent c59b244d04
commit 0645402946

View File

@ -702,11 +702,13 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
{
entry = &directory.entries[i];
if( !memcmp( entry->resource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
if( entry->filepos > 0 &&
entry->disksize > 0 &&
!memcmp( entry->resource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
{
FS_Seek( f, entry->filepos, SEEK_SET );
if( buffer && entry->disksize > 0 )
if( buffer )
{
tmpbuf = Z_Malloc( entry->disksize );
FS_Read( f, tmpbuf, entry->disksize );