engine: fix crash when reading GoldSrc hashpaks
This commit is contained in:
parent
c59b244d04
commit
0645402946
1 changed files with 5 additions and 3 deletions
|
@ -647,7 +647,7 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
|
||||||
|
|
||||||
for( p = gp_hpak_queue; p != NULL; p = p->next )
|
for( p = gp_hpak_queue; p != NULL; p = p->next )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp(p->name, filename ) && !memcmp( p->resource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
|
if( !Q_stricmp( p->name, filename ) && !memcmp( p->resource.rgucMD5_hash, pResource->rgucMD5_hash, 16 ))
|
||||||
{
|
{
|
||||||
if( buffer )
|
if( buffer )
|
||||||
{
|
{
|
||||||
|
@ -702,11 +702,13 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
|
||||||
{
|
{
|
||||||
entry = &directory.entries[i];
|
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 );
|
FS_Seek( f, entry->filepos, SEEK_SET );
|
||||||
|
|
||||||
if( buffer && entry->disksize > 0 )
|
if( buffer )
|
||||||
{
|
{
|
||||||
tmpbuf = Z_Malloc( entry->disksize );
|
tmpbuf = Z_Malloc( entry->disksize );
|
||||||
FS_Read( f, tmpbuf, entry->disksize );
|
FS_Read( f, tmpbuf, entry->disksize );
|
||||||
|
|
Loading…
Add table
Reference in a new issue