瀏覽代碼

Fix find_* argument parsing crash (#11513)

Previously the command

  find_path(VAR DOC "")

would crash because the argument pre-processing removed the DOC ""
arguments but the rest of the parsing assumes at least 2 arguments.
Reject the call with an error instead.
Brad King 15 年之前
父節點
當前提交
183d261b11
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Source/cmFindBase.cxx

+ 5 - 0
Source/cmFindBase.cxx

@@ -164,6 +164,11 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
         }
       }
     }
+  if(args.size() < 2 )
+    {
+    this->SetError("called with incorrect number of arguments");
+    return false;
+    }
   this->VariableName = args[0];
   if(this->CheckForVariableInCache())
     {