mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
Added lump size validation to the WAD loader
This commit is contained in:
parent
0ed1077f29
commit
cbe4c9c5c1
1 changed files with 11 additions and 0 deletions
|
@ -188,6 +188,17 @@ bool FWadFile::Open(bool quiet)
|
||||||
Lumps[i].Namespace = ns_global;
|
Lumps[i].Namespace = ns_global;
|
||||||
Lumps[i].Flags = Lumps[i].Compressed? LUMPF_COMPRESSED : 0;
|
Lumps[i].Flags = Lumps[i].Compressed? LUMPF_COMPRESSED : 0;
|
||||||
Lumps[i].FullName = NULL;
|
Lumps[i].FullName = NULL;
|
||||||
|
|
||||||
|
// Check if the lump is within the WAD file and print a warning if not.
|
||||||
|
if (Lumps[i].Position + Lumps[i].LumpSize > wadSize || Lumps[i].Position < 0 || Lumps[i].LumpSize < 0)
|
||||||
|
{
|
||||||
|
if (Lumps[i].LumpSize != 0)
|
||||||
|
{
|
||||||
|
Printf(PRINT_HIGH, "%s: Lump %s contains invalid positioning info and will be ignored\n", Filename, Lumps[i].Name);
|
||||||
|
Lumps[i].Name[0] = 0;
|
||||||
|
}
|
||||||
|
Lumps[i].LumpSize = Lumps[i].Position = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] fileinfo;
|
delete[] fileinfo;
|
||||||
|
|
Loading…
Reference in a new issue