fix warn reports for buffer oveeruns

also misc uninitialized vars
This commit is contained in:
AzaezelX 2023-04-26 22:29:32 -05:00
parent 1230d0d280
commit 9e036f142b
6 changed files with 11 additions and 9 deletions

View file

@ -309,7 +309,7 @@ void CodeBlock::calcBreakList()
if (seqCount)
size++;
breakList = new U32[size];
breakList = new U32[size+3];
breakListSize = size;
line = -1;
seqCount = 0;
@ -434,7 +434,7 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
st.read(&lineBreakPairCount);
U32 totSize = codeLength + lineBreakPairCount * 2;
code = new U32[totSize];
code = new U32[totSize+1];
// 0xFF is used as a flag to help compress the bytecode.
// If detected, the bytecode is only a U8.
@ -1301,6 +1301,7 @@ void CodeBlock::dumpInstructions(U32 startIp, bool upToReturn)
case FuncCallExprNode::MethodCall: callTypeName = "MethodCall"; break;
case FuncCallExprNode::ParentCall: callTypeName = "ParentCall"; break;
case FuncCallExprNode::StaticCall: callTypeName = "StaticCall"; break;
default: callTypeName = "INVALID"; break;
}
Con::printf("%i: OP_CALLFUNC stk=+1 name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, callTypeName);

View file

@ -146,7 +146,7 @@ bool isFloat(const char* str, bool sciOk = false)
}
break;
case '.':
if(seenDot | (sciOk && eLoc != -1))
if(seenDot || (sciOk && eLoc != -1))
return false;
seenDot = true;
break;

View file

@ -682,7 +682,7 @@ public:
T::initPersistFields();
T::consoleInit();
EnginePropertyTable::Property* props = new EnginePropertyTable::Property[sg_tempFieldList.size()];
EnginePropertyTable::Property* props = new EnginePropertyTable::Property[sg_tempFieldList.size() + 1];
for (int i = 0; i < sg_tempFieldList.size(); ++i)
{
@ -825,7 +825,7 @@ class ConsoleObject : public EngineObject
protected:
/// @deprecated This is disallowed.
ConsoleObject(const ConsoleObject&);
ConsoleObject(const ConsoleObject&) { mDocsClick = false; };
public:
/// <summary>
@ -863,7 +863,7 @@ public:
public:
/// Get the classname from a class tag.
static const char* lookupClassName(const U32 in_classTag);
static const char* lookupClassName(const U32 in_classTag) {};
/// @name Fields
/// @{

View file

@ -166,7 +166,7 @@ class EngineExportScope : public EngineExport
private:
/// Constructor for the global scope.
EngineExportScope(){}
EngineExportScope():mExports(NULL){}
};

View file

@ -890,6 +890,7 @@ DefineEngineMethod( SimSet, listObjects, void, (),,
for(itr = object->begin(); itr != object->end(); itr++)
{
SimObject *obj = *itr;
if (obj == nullptr) continue;
bool isSet = dynamic_cast<SimSet *>(obj) != 0;
const char *name = obj->getName();
if(name)

View file

@ -352,8 +352,8 @@ class Journal
template<typename T>
struct MethodRep: public FuncDecl {
typename T::ObjPtr obj;
typename T::MethodPtr method;
typename T::ObjPtr obj = NULL;
typename T::MethodPtr method = NULL;
virtual bool match(VoidPtr ptr,VoidMethod func) const {
return obj == (typename T::ObjPtr)ptr && method == (typename T::MethodPtr)func;
}