ide;findInFiles; (~#1000) Partial fix for Out of bounds crash on Find in Files
authorRejean Loyer <rejean.loyer@gmail.com>
Mon, 30 Sep 2013 08:02:31 +0000 (04:02 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 30 Sep 2013 08:25:06 +0000 (04:25 -0400)
- Fixed out of bounds crash
- Fixed continuous resolving of network node in PathBox until server is all typed
- PathBox remains to be fixed to use \\ and not // for network path or FileListing must be fixed

ecere/src/gui/controls/PathBox.ec
ide/src/dialogs/FindInFilesDialog.ec

index 159361c..1c476bf 100644 (file)
@@ -248,9 +248,10 @@ public class PathBox : CommonControl
       {
          BitmapResource icon = null;
          char path[MAX_LOCATION];
-         FileAttribs exists;
+         FileAttribs exists { };
          GetSystemPathBuffer(path, editBox.contents);
-         exists = FileExists(path);
+         if(!(path[0] == DIR_SEP && path[1] == DIR_SEP && (!path[2] || !strchr(&path[2], DIR_SEP))))
+            exists = FileExists(path);
          
          switch(typeExpected)
          {
index 2b7856c..e488732 100644 (file)
@@ -603,6 +603,8 @@ private:
    }
 }
 
+static define stackSize = 1024;
+
 class SearchThread : Thread
 {
 public:
@@ -650,7 +652,7 @@ private:
       int frame, treeTop = 0;
       int globalFindCount = 0, filesSearchedCount = 0, filesMatchedCount = 0, dirsMatchedCount = 0;
       //double lastTime = GetTime();
-      SearchStackFrame stack[1024];
+      SearchStackFrame stack[stackSize];
       FindInFilesMode mode = this.mode;
       
       EditBox replaceEdit = null;
@@ -714,7 +716,7 @@ private:
          strcpy(stack[0].path, dir);
          stack[0].fileList = FileListing { dir, extensions = filter.extensions };  // there should be a sorted = true/false 
 
-         for(frame = 0; frame >= 0 && !abort; )
+         for(frame = 0; frame >= 0 && frame < stackSize && !abort; )
          {
             if(stack[frame].fileList.Find())
             {