summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/Glob.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-21 19:30:07 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-08-21 19:30:07 (GMT)
commita8128f88b72d8ea412c54353eae197da8cccc817 (patch)
treed250373a9259a52e5cb421a1f9c7d7350e1ccc15 /Source/kwsys/Glob.cxx
parent326e1144398d9aa48e4a46088c5fe535c22bd582 (diff)
downloadCMake-a8128f88b72d8ea412c54353eae197da8cccc817.zip
CMake-a8128f88b72d8ea412c54353eae197da8cccc817.tar.gz
CMake-a8128f88b72d8ea412c54353eae197da8cccc817.tar.bz2
BUG: fix segfault if FindFiles() is called without actual match pattern
(e.g. FILE(GLOB /usr/include) instead of FILE(GLOB /usr/include/* ) #4620 Alex
Diffstat (limited to 'Source/kwsys/Glob.cxx')
-rw-r--r--Source/kwsys/Glob.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 7ef2fed..6858689 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -253,8 +253,9 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
if ( !dir_only || !kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
{
- if ( this->Internals->Expressions[
- this->Internals->Expressions.size()-1].find(fname.c_str()) )
+ if ( (this->Internals->Expressions.size() > 0) &&
+ this->Internals->Expressions[
+ this->Internals->Expressions.size()-1].find(fname.c_str()) )
{
this->AddFile(this->Internals->Files, realname.c_str());
}
@@ -277,6 +278,12 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
this->RecurseDirectory(start, dir, dir_only);
return;
}
+
+ if ( start >= this->Internals->Expressions.size() )
+ {
+ return;
+ }
+
kwsys::Directory d;
if ( !d.Load(dir.c_str()) )
{