uninitialized variables-console

This commit is contained in:
AzaezelX 2020-05-11 14:40:31 -05:00
parent e9415a0994
commit 2c1508c169
23 changed files with 66 additions and 11 deletions

View file

@ -142,6 +142,7 @@ StmtNode::StmtNode()
{ {
mNext = NULL; mNext = NULL;
dbgFileName = CodeBlock::smCurrentParser->getCurrentFile(); dbgFileName = CodeBlock::smCurrentParser->getCurrentFile();
dbgLineNumber = 0;
} }
void StmtNode::setPackage(StringTableEntry) void StmtNode::setPackage(StringTableEntry)

View file

@ -56,6 +56,9 @@ CodeBlock::CodeBlock()
name = NULL; name = NULL;
fullPath = NULL; fullPath = NULL;
modPath = NULL; modPath = NULL;
codeSize = 0;
lineBreakPairCount = 0;
nextFile = NULL;
} }
CodeBlock::~CodeBlock() CodeBlock::~CodeBlock()

View file

@ -224,6 +224,9 @@ CodeInterpreter::CodeInterpreter(CodeBlock *cb) :
mSaveCodeBlock(nullptr), mSaveCodeBlock(nullptr),
mCurrentInstruction(0) mCurrentInstruction(0)
{ {
dMemset(&mExec, 0, sizeof(mExec));
dMemset(&mObjectCreationStack, 0, sizeof(mObjectCreationStack));
dMemset(&mNSDocBlockClass, 0, sizeof(mNSDocBlockClass));
} }
CodeInterpreter::~CodeInterpreter() CodeInterpreter::~CodeInterpreter()

View file

@ -317,7 +317,7 @@ protected:
U32 addr; ///< Address to patch U32 addr; ///< Address to patch
U32 value; ///< Value to place at addr U32 value; ///< Value to place at addr
PatchEntry() { ; } PatchEntry(): addr(0), value(0) { ; }
PatchEntry(U32 a, U32 v) : addr(a), value(v) { ; } PatchEntry(U32 a, U32 v) : addr(a), value(v) { ; }
} PatchEntry; } PatchEntry;

View file

@ -475,7 +475,7 @@ Dictionary::Entry::Entry(StringTableEntry in_name)
nextEntry = NULL; nextEntry = NULL;
mUsage = NULL; mUsage = NULL;
mIsConstant = false; mIsConstant = false;
mNext = NULL;
// NOTE: This is data inside a nameless // NOTE: This is data inside a nameless
// union, so we don't need to init the rest. // union, so we don't need to init the rest.
value.init(); value.init();
@ -856,6 +856,7 @@ ExprEvalState::ExprEvalState()
stack.reserve(64); stack.reserve(64);
mShouldReset = false; mShouldReset = false;
mResetLocked = false; mResetLocked = false;
copyVariable = NULL;
} }
ExprEvalState::~ExprEvalState() ExprEvalState::~ExprEvalState()
@ -927,6 +928,15 @@ Namespace::Entry::Entry()
mUsage = NULL; mUsage = NULL;
mHeader = NULL; mHeader = NULL;
mNamespace = NULL; mNamespace = NULL;
cb.mStringCallbackFunc = NULL;
mFunctionLineNumber = 0;
mFunctionName = StringTable->EmptyString();
mFunctionOffset = 0;
mMinArgs = 0;
mMaxArgs = 0;
mNext = NULL;
mPackage = StringTable->EmptyString();
mToolOnly = false;
} }
void Namespace::Entry::clear() void Namespace::Entry::clear()
@ -959,6 +969,7 @@ Namespace::Namespace()
mHashSequence = 0; mHashSequence = 0;
mRefCountToParent = 0; mRefCountToParent = 0;
mClassRep = 0; mClassRep = 0;
lastUsage = NULL;
} }
Namespace::~Namespace() Namespace::~Namespace()

View file

@ -306,6 +306,7 @@ public:
nextEntry = NULL; nextEntry = NULL;
mUsage = NULL; mUsage = NULL;
mIsConstant = false; mIsConstant = false;
mNext = NULL;
value.init(); value.init();
} }

View file

@ -220,7 +220,21 @@ public:
: Parent( sizeof( void* ), conIdPtr, typeName ) : Parent( sizeof( void* ), conIdPtr, typeName )
{ {
VECTOR_SET_ASSOCIATION( mFieldList ); VECTOR_SET_ASSOCIATION( mFieldList );
mCategory = StringTable->EmptyString();
mClassGroupMask = 0;
std::fill_n(mClassId, NetClassGroupsCount, -1);
mClassName = StringTable->EmptyString();
mClassSizeof = 0;
mClassType = 0;
mDescription = StringTable->EmptyString();
#ifdef TORQUE_NET_STATS
dMemset(mDirtyMaskFrequency, 0, sizeof(mDirtyMaskFrequency));
dMemset(mDirtyMaskTotal, 0, sizeof(mDirtyMaskTotal));
#endif
mDynamicGroupExpand = false;
mNamespace = NULL;
mNetEventDir = 0;
nextClass = NULL;
parentClass = NULL; parentClass = NULL;
mIsRenderEnabled = true; mIsRenderEnabled = true;
mIsSelectionEnabled = true; mIsSelectionEnabled = true;
@ -496,6 +510,7 @@ public:
validator( NULL ), validator( NULL ),
setDataFn( NULL ), setDataFn( NULL ),
getDataFn( NULL ), getDataFn( NULL ),
writeDataFn(NULL),
networkMask(0) networkMask(0)
{ {
doNotSubstitute = keepClearSubsOnly = false; doNotSubstitute = keepClearSubsOnly = false;

View file

@ -1190,7 +1190,7 @@ public:
ConsoleValueRef _exec(); ConsoleValueRef _exec();
ConsoleValueRef _execLater(SimConsoleThreadExecEvent *evt); ConsoleValueRef _execLater(SimConsoleThreadExecEvent *evt);
_BaseEngineConsoleCallbackHelper() {;} _BaseEngineConsoleCallbackHelper(): mThis(NULL), mInitialArgc(0), mArgc(0), mCallbackName(StringTable->EmptyString()){;}
}; };

View file

@ -123,6 +123,7 @@ class EngineExport : public StaticEngineObject
: mExportName( "" ), : mExportName( "" ),
mExportKind( EngineExportKindScope ), mExportKind( EngineExportKindScope ),
mExportScope( NULL ), mExportScope( NULL ),
mDocString(""),
mNextExport( NULL ) {} mNextExport( NULL ) {}
}; };
@ -165,7 +166,7 @@ class EngineExportScope : public EngineExport
private: private:
/// Constructor for the global scope. /// Constructor for the global scope.
EngineExportScope() {} EngineExportScope():mExports(NULL){}
}; };

View file

@ -53,7 +53,7 @@ void*& _USERDATA( EngineObject* object )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
EngineObject::EngineObject() EngineObject::EngineObject()
: mEngineObjectUserData( NULL ) : mEngineObjectPool(NULL), mEngineObjectUserData( NULL )
{ {
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
// Add to instance list. // Add to instance list.

View file

@ -58,6 +58,7 @@ EngineTypeInfo::EngineTypeInfo( const char* typeName, EngineExportScope* scope,
mEnumTable( NULL ), mEnumTable( NULL ),
mFieldTable( NULL ), mFieldTable( NULL ),
mPropertyTable( NULL ), mPropertyTable( NULL ),
mArgumentTypeTable(NULL),
mSuperType( NULL ), mSuperType( NULL ),
mNext( smFirst ) mNext( smFirst )
{ {

View file

@ -55,6 +55,7 @@ ConsoleDocClass( SimDataBlock,
SimDataBlock::SimDataBlock() SimDataBlock::SimDataBlock()
{ {
modifiedKey = 0;
setModDynamicFields(true); setModDynamicFields(true);
setModStaticFields(true); setModStaticFields(true);
} }

View file

@ -31,6 +31,8 @@ SimNameDictionary::SimNameDictionary()
{ {
#ifndef USE_NEW_SIMDICTIONARY #ifndef USE_NEW_SIMDICTIONARY
hashTable = NULL; hashTable = NULL;
hashTableSize = DefaultTableSize;
hashEntryCount = 0;
#endif #endif
mutex = Mutex::createMutex(); mutex = Mutex::createMutex();
} }

View file

@ -62,7 +62,7 @@ public:
/// of addition to the list. /// of addition to the list.
SimObject *destObject; ///< Object on which this event will be applied. SimObject *destObject; ///< Object on which this event will be applied.
SimEvent() { destObject = NULL; } SimEvent() { nextEvent = NULL; startTime = 0; time = 0; sequenceCount = 0; destObject = NULL; }
virtual ~SimEvent() {} ///< Destructor virtual ~SimEvent() {} ///< Destructor
/// ///
/// A dummy virtual destructor is required /// A dummy virtual destructor is required

View file

@ -47,7 +47,7 @@ class SimFieldDictionary
public: public:
struct Entry struct Entry
{ {
Entry() : type(NULL) {}; Entry() : slotName(StringTable->EmptyString()), value(NULL), next(NULL), type(NULL) {};
StringTableEntry slotName; StringTableEntry slotName;
char *value; char *value;
@ -112,4 +112,4 @@ public:
}; };
#endif // _SIMFIELDDICTIONARY_H_ #endif // _SIMFIELDDICTIONARY_H_

View file

@ -1380,6 +1380,7 @@ SimObject::SimObject(const SimObject& other, bool temp_clone)
nextIdObject = other.nextIdObject; nextIdObject = other.nextIdObject;
mGroup = other.mGroup; mGroup = other.mGroup;
mFlags = other.mFlags; mFlags = other.mFlags;
mProgenitorFile = other.mProgenitorFile;
mCopySource = other.mCopySource; mCopySource = other.mCopySource;
mFieldDictionary = other.mFieldDictionary; mFieldDictionary = other.mFieldDictionary;
//mIdString = other.mIdString; // special treatment (see below) //mIdString = other.mIdString; // special treatment (see below)

View file

@ -30,7 +30,12 @@ StringStack::StringStack()
mBuffer = NULL; mBuffer = NULL;
mArgBufferSize = 0; mArgBufferSize = 0;
mArgBuffer = NULL; mArgBuffer = NULL;
for (U32 i = 0; i < MaxArgs; i++)
mArgV[i] = "";
dMemset(mFrameOffsets, 0, sizeof(mFrameOffsets));
dMemset(mStartOffsets, 0, sizeof(mStartOffsets));
mNumFrames = 0; mNumFrames = 0;
mArgc = 0;
mStart = 0; mStart = 0;
mLen = 0; mLen = 0;
mStartStackSize = 0; mStartStackSize = 0;
@ -232,6 +237,7 @@ mStackPos(0)
mStack[i].init(); mStack[i].init();
mStack[i].type = ConsoleValue::TypeInternalString; mStack[i].type = ConsoleValue::TypeInternalString;
} }
dMemset(mStackFrames, 0, sizeof(mStackFrames));
} }
ConsoleValueStack::~ConsoleValueStack() ConsoleValueStack::~ConsoleValueStack()

View file

@ -88,6 +88,9 @@ TelnetConsole::TelnetConsole()
mAcceptPort = -1; mAcceptPort = -1;
mClientList = NULL; mClientList = NULL;
mRemoteEchoEnabled = false; mRemoteEchoEnabled = false;
dStrncpy(mTelnetPassword, "", PasswordMaxLength);
dStrncpy(mListenPassword, "", PasswordMaxLength);
} }
TelnetConsole::~TelnetConsole() TelnetConsole::~TelnetConsole()

View file

@ -78,6 +78,7 @@ class TelnetConsole
S32 state; ///< State of the client. S32 state; ///< State of the client.
/// @see TelnetConsole::State /// @see TelnetConsole::State
TelnetClient *nextClient; TelnetClient *nextClient;
TelnetClient() { dStrncpy(curLine, "", Con::MaxLineLength); curPos = 0; state = 0; nextClient = NULL; }
}; };
TelnetClient *mClientList; TelnetClient *mClientList;
TelnetConsole(); TelnetConsole();

View file

@ -163,6 +163,9 @@ TelnetDebugger::TelnetDebugger()
mProgramPaused = false; mProgramPaused = false;
mWaitForClient = false; mWaitForClient = false;
dStrncpy(mDebuggerPassword, "", PasswordMaxLength);
dStrncpy(mLineBuffer, "", sizeof(mLineBuffer));
// Add the version number in a global so that // Add the version number in a global so that
// scripts can detect the presence of the // scripts can detect the presence of the
// "enhanced" debugger features. // "enhanced" debugger features.

View file

@ -27,7 +27,8 @@ class TypeValidator
{ {
public: public:
S32 fieldIndex; S32 fieldIndex;
TypeValidator() : fieldIndex(0) {}
~TypeValidator() {}
/// Prints a console error message for the validator. /// Prints a console error message for the validator.
/// ///
/// The message is prefaced with with: /// The message is prefaced with with:

View file

@ -203,7 +203,7 @@ public:
class StockColorItem class StockColorItem
{ {
private: private:
StockColorItem() {} StockColorItem():mColorName("") {}
public: public:
StockColorItem( const char* pName, const U8 red, const U8 green, const U8 blue, const U8 alpha = 255 ) StockColorItem( const char* pName, const U8 red, const U8 green, const U8 blue, const U8 alpha = 255 )

View file

@ -295,6 +295,7 @@ public:
AssertFatal( count > 0, "Allocating a FrameTemp with less than one instance" ); \ AssertFatal( count > 0, "Allocating a FrameTemp with less than one instance" ); \
mWaterMark = FrameAllocator::getWaterMark(); \ mWaterMark = FrameAllocator::getWaterMark(); \
mMemory = reinterpret_cast<type *>( FrameAllocator::alloc( sizeof( type ) * count ) ); \ mMemory = reinterpret_cast<type *>( FrameAllocator::alloc( sizeof( type ) * count ) ); \
mNumObjectsInMemory = 0; \
} \ } \
template<>\ template<>\
inline FrameTemp<type>::~FrameTemp() \ inline FrameTemp<type>::~FrameTemp() \