소스 검색

Merge pull request #456 from smally/tsnaming_heapcorruption

Heap corruption caused by incorrect Torque Script naming
SilentMike 12 년 전
부모
커밋
e1830fdf2c
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      Engine/source/console/compiledEval.cpp

+ 9 - 0
Engine/source/console/compiledEval.cpp

@@ -650,6 +650,15 @@ breakContinue:
                // IF we aren't looking at a local/internal object, then check if 
                // this object already exists in the global space
 
+               AbstractClassRep* rep = AbstractClassRep::findClassRep( objectName );
+               if (rep != NULL) {
+                  Con::errorf(ConsoleLogEntry::General, "%s: Cannot name object [%s] the same name as a script class.",
+                     getFileLine(ip), objectName);
+                  ip = failJump;
+                  STR.popFrame();
+                  break;
+               }
+
                SimObject *obj = Sim::findObject( objectName );
                if (obj /*&& !obj->isLocalName()*/)
                {