Browse Source

engine: fix crash when reading GoldSrc hashpaks

pull/2/head
Alibek Omarov 2 years ago
parent
commit
0645402946
  1. 6
      engine/common/hpak.c

6
engine/common/hpak.c

@ -702,11 +702,13 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte @@ -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 );

Loading…
Cancel
Save