mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-09 13:30:34 +00:00
template -- check if ptr is valid
This commit is contained in:
parent
15d0eded63
commit
25357e2666
@ -1,6 +1,7 @@
|
|||||||
#include "template.h"
|
#include "template.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "debugger_internal.h"
|
#include "debugger_internal.h"
|
||||||
|
#include "loader.h" // Flags.
|
||||||
|
|
||||||
#include <toolbox/toolbox.h>
|
#include <toolbox/toolbox.h>
|
||||||
|
|
||||||
@ -60,6 +61,12 @@ namespace Debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool ValidPointer(uint32_t value)
|
||||||
|
{
|
||||||
|
return value && value < Flags.memorySize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateTypedef(const std::string *name, int type, TemplateParseInfo *info)
|
void CreateTypedef(const std::string *name, int type, TemplateParseInfo *info)
|
||||||
@ -153,8 +160,7 @@ namespace Debug {
|
|||||||
|
|
||||||
case kPStringPtr:
|
case kPStringPtr:
|
||||||
// read the string...
|
// read the string...
|
||||||
if (!value) return;
|
if (ValidPointer(value))
|
||||||
// need function to check if it's a valid pointer?
|
|
||||||
{
|
{
|
||||||
std::string tmp = ReadPString(value);
|
std::string tmp = ReadPString(value);
|
||||||
CleanupString(tmp);
|
CleanupString(tmp);
|
||||||
@ -164,8 +170,7 @@ namespace Debug {
|
|||||||
|
|
||||||
case kCStringPtr:
|
case kCStringPtr:
|
||||||
// read the string...
|
// read the string...
|
||||||
if (!value) return;
|
if (ValidPointer(value))
|
||||||
// need function to check if it's a valid pointer?
|
|
||||||
{
|
{
|
||||||
std::string tmp = ReadCString(value);
|
std::string tmp = ReadCString(value);
|
||||||
CleanupString(tmp);
|
CleanupString(tmp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user