mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 00:21:35 +00:00
Added detection for broken WAD files
Do not try to allocate nonsensical amount of memory and bail out when broken WAD is detected See http://forum.drdteam.org/viewtopic.php?t=6844
This commit is contained in:
parent
93323b64f8
commit
9b23b41021
1 changed files with 7 additions and 0 deletions
|
@ -39,6 +39,7 @@
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
|
||||||
// Console Doom LZSS wrapper.
|
// Console Doom LZSS wrapper.
|
||||||
class FileReaderLZSS : public FileReaderBase
|
class FileReaderLZSS : public FileReaderBase
|
||||||
|
@ -343,6 +344,12 @@ bool FWadFile::Open(bool quiet)
|
||||||
NumLumps = BigLong(header.NumLumps);
|
NumLumps = BigLong(header.NumLumps);
|
||||||
InfoTableOfs = BigLong(header.InfoTableOfs);
|
InfoTableOfs = BigLong(header.InfoTableOfs);
|
||||||
isBigEndian = true;
|
isBigEndian = true;
|
||||||
|
|
||||||
|
// Check again to detect broken wads
|
||||||
|
if (InfoTableOfs + NumLumps*sizeof(wadlump_t) > (unsigned)wadSize)
|
||||||
|
{
|
||||||
|
I_Error("Cannot load broken WAD file %s\n", Filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wadlump_t *fileinfo = new wadlump_t[NumLumps];
|
wadlump_t *fileinfo = new wadlump_t[NumLumps];
|
||||||
|
|
Loading…
Reference in a new issue