mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-15 09:01:24 +00:00
Added lump size validation to the WAD loader
(cherry picked from commit cbe4c9c5c1
)
This commit is contained in:
parent
021f5cf656
commit
bf632cc31a
1 changed files with 11 additions and 0 deletions
|
@ -191,6 +191,17 @@ bool FWadFile::Open(bool quiet)
|
|||
Lumps[i].Namespace = ns_global;
|
||||
Lumps[i].Flags = Lumps[i].Compressed? LUMPF_COMPRESSED : 0;
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue