mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
-Fixes in new resource file code: Added file length checks and set lump count to 1 for single lump files.
SVN r1558 (trunk)
This commit is contained in:
parent
1ea8777572
commit
2e90519c13
7 changed files with 61 additions and 42 deletions
|
@ -334,6 +334,8 @@ FResourceFile *Check7Z(const char *filename, FileReader *file)
|
||||||
{
|
{
|
||||||
char head[k7zSignatureSize];
|
char head[k7zSignatureSize];
|
||||||
|
|
||||||
|
if (file->GetLength() >= k7zSignatureSize)
|
||||||
|
{
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
file->Read(&head, k7zSignatureSize);
|
file->Read(&head, k7zSignatureSize);
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
|
@ -343,6 +345,7 @@ FResourceFile *Check7Z(const char *filename, FileReader *file)
|
||||||
if (rf->Open()) return rf;
|
if (rf->Open()) return rf;
|
||||||
delete rf;
|
delete rf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,8 @@ FResourceFile *CheckGRP(const char *filename, FileReader *file)
|
||||||
{
|
{
|
||||||
char head[12];
|
char head[12];
|
||||||
|
|
||||||
|
if (file->GetLength() >= 12)
|
||||||
|
{
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
file->Read(&head, 12);
|
file->Read(&head, 12);
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
|
@ -147,6 +149,7 @@ FResourceFile *CheckGRP(const char *filename, FileReader *file)
|
||||||
if (rf->Open()) return rf;
|
if (rf->Open()) return rf;
|
||||||
delete rf;
|
delete rf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ bool FLumpFile::Open()
|
||||||
Lumps->Namespace = ns_global;
|
Lumps->Namespace = ns_global;
|
||||||
Lumps->Flags = 0;
|
Lumps->Flags = 0;
|
||||||
Lumps->FullName = NULL;
|
Lumps->FullName = NULL;
|
||||||
|
NumLumps = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,8 @@ FResourceFile *CheckPak(const char *filename, FileReader *file)
|
||||||
{
|
{
|
||||||
char head[4];
|
char head[4];
|
||||||
|
|
||||||
|
if (file->GetLength() >= 12)
|
||||||
|
{
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
file->Read(&head, 4);
|
file->Read(&head, 4);
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
|
@ -139,6 +141,7 @@ FResourceFile *CheckPak(const char *filename, FileReader *file)
|
||||||
if (rf->Open()) return rf;
|
if (rf->Open()) return rf;
|
||||||
delete rf;
|
delete rf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,8 @@ FResourceFile *CheckRFF(const char *filename, FileReader *file)
|
||||||
{
|
{
|
||||||
char head[4];
|
char head[4];
|
||||||
|
|
||||||
|
if (file->GetLength() >= 16)
|
||||||
|
{
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
file->Read(&head, 4);
|
file->Read(&head, 4);
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
|
@ -244,6 +246,7 @@ FResourceFile *CheckRFF(const char *filename, FileReader *file)
|
||||||
if (rf->Open()) return rf;
|
if (rf->Open()) return rf;
|
||||||
delete rf;
|
delete rf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,6 +328,8 @@ FResourceFile *CheckWad(const char *filename, FileReader *file)
|
||||||
{
|
{
|
||||||
char head[4];
|
char head[4];
|
||||||
|
|
||||||
|
if (file->GetLength() >= 12)
|
||||||
|
{
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
file->Read(&head, 4);
|
file->Read(&head, 4);
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
|
@ -337,6 +339,7 @@ FResourceFile *CheckWad(const char *filename, FileReader *file)
|
||||||
if (rf->Open()) return rf;
|
if (rf->Open()) return rf;
|
||||||
delete rf;
|
delete rf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,6 +391,8 @@ FResourceFile *CheckZip(const char *filename, FileReader *file)
|
||||||
{
|
{
|
||||||
char head[4];
|
char head[4];
|
||||||
|
|
||||||
|
if (file->GetLength() >= sizeof(FZipLocalFileHeader))
|
||||||
|
{
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
file->Read(&head, 4);
|
file->Read(&head, 4);
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
|
@ -400,6 +402,7 @@ FResourceFile *CheckZip(const char *filename, FileReader *file)
|
||||||
if (rf->Open()) return rf;
|
if (rf->Open()) return rf;
|
||||||
delete rf;
|
delete rf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue