소스 검색

fix warn reports for buffer oveeruns
also misc uninitialized vars

AzaezelX 2 년 전
부모
커밋
9e036f142b

+ 3 - 2
Engine/source/console/codeBlock.cpp

@@ -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);

+ 1 - 1
Engine/source/console/consoleFunctions.cpp

@@ -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;

+ 3 - 3
Engine/source/console/consoleObject.h

@@ -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
    /// @{

+ 1 - 1
Engine/source/console/engineExports.h

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

+ 1 - 0
Engine/source/console/simSet.cpp

@@ -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)

+ 2 - 2
Engine/source/core/util/journal/journal.h

@@ -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;
       }