mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-02-07 13:41:02 +00:00
- Fixed P_CheckMapData allowed non-map lump names to pass resulting in a crash when actually trying to load the map.
This commit is contained in:
parent
3480d40484
commit
bb494292c6
3 changed files with 50 additions and 16 deletions
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
|
|
||||||
|
#include "doomerrors.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
|
@ -343,22 +344,30 @@ CCMD (changemap)
|
||||||
|
|
||||||
if (argv.argc() > 1)
|
if (argv.argc() > 1)
|
||||||
{
|
{
|
||||||
if (!P_CheckMapData(argv[1]))
|
try
|
||||||
{
|
{
|
||||||
Printf ("No map %s\n", argv[1]);
|
if (!P_CheckMapData(argv[1]))
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (argv.argc() > 2)
|
|
||||||
{
|
{
|
||||||
Net_WriteByte (DEM_CHANGEMAP2);
|
Printf ("No map %s\n", argv[1]);
|
||||||
Net_WriteByte (atoi(argv[2]));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Net_WriteByte (DEM_CHANGEMAP);
|
if (argv.argc() > 2)
|
||||||
|
{
|
||||||
|
Net_WriteByte (DEM_CHANGEMAP2);
|
||||||
|
Net_WriteByte (atoi(argv[2]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Net_WriteByte (DEM_CHANGEMAP);
|
||||||
|
}
|
||||||
|
Net_WriteString (argv[1]);
|
||||||
}
|
}
|
||||||
Net_WriteString (argv[1]);
|
}
|
||||||
|
catch(CRecoverableError &error)
|
||||||
|
{
|
||||||
|
if (error.GetMessage())
|
||||||
|
Printf("%s", error.GetMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
|
#include "doomerrors.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "wi_stuff.h"
|
#include "wi_stuff.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
@ -170,13 +171,21 @@ CCMD (map)
|
||||||
}
|
}
|
||||||
if (argv.argc() > 1)
|
if (argv.argc() > 1)
|
||||||
{
|
{
|
||||||
if (!P_CheckMapData(argv[1]))
|
try
|
||||||
{
|
{
|
||||||
Printf ("No map %s\n", argv[1]);
|
if (!P_CheckMapData(argv[1]))
|
||||||
|
{
|
||||||
|
Printf ("No map %s\n", argv[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
G_DeferedInitNew (argv[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch(CRecoverableError &error)
|
||||||
{
|
{
|
||||||
G_DeferedInitNew (argv[1]);
|
if (error.GetMessage())
|
||||||
|
Printf("%s", error.GetMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -329,7 +329,15 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
// Since levels must be stored in WADs they can't really have full
|
// Since levels must be stored in WADs they can't really have full
|
||||||
// names and for any valid level lump this always returns the short name.
|
// names and for any valid level lump this always returns the short name.
|
||||||
const char * lumpname = Wads.GetLumpFullName(lump_name + i);
|
const char * lumpname = Wads.GetLumpFullName(lump_name + i);
|
||||||
index = GetMapIndex(mapname, index, lumpname, i != 1 || Wads.LumpLength(lump_name + i) == 0);
|
try
|
||||||
|
{
|
||||||
|
index = GetMapIndex(mapname, index, lumpname, true);
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
delete map;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
||||||
|
|
||||||
// The next lump is not part of this map anymore
|
// The next lump is not part of this map anymore
|
||||||
|
@ -461,7 +469,15 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
|
|
||||||
if (i>0)
|
if (i>0)
|
||||||
{
|
{
|
||||||
index = GetMapIndex(maplabel, index, lumpname, true);
|
try
|
||||||
|
{
|
||||||
|
index = GetMapIndex(maplabel, index, lumpname, true);
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
delete map;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
||||||
|
|
||||||
// The next lump is not part of this map anymore
|
// The next lump is not part of this map anymore
|
||||||
|
|
Loading…
Reference in a new issue