From cebd38891a4e905a71cb8aaa105e878bbeb1917b Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Thu, 28 Jan 2016 08:35:20 -0500 Subject: [PATCH] avoid infinite loops when attempting to automatically locate the SDK --- openbr/openbr_plugin.cpp | 3 +++ 1 file changed, 3 insertions(+), 0 deletions(-) diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index a95dc4f..3f1adc8 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -1245,6 +1245,7 @@ void br::Context::initialize(int &argc, char *argv[], QString sdkPath, bool useG if (sdkPath.isEmpty()) { QStringList checkPaths; checkPaths << QCoreApplication::applicationDirPath() << QDir::currentPath(); checkPaths << QString(getenv("PATH")).split(sep, QString::SkipEmptyParts); + QSet checkedPaths; // Avoid infinite loops from symlinks bool foundSDK = false; foreach (const QString &path, checkPaths) { @@ -1252,6 +1253,8 @@ void br::Context::initialize(int &argc, char *argv[], QString sdkPath, bool useG QDir dir(path); do { sdkPath = dir.absolutePath(); + if (checkedPaths.contains(sdkPath)) break; + else checkedPaths.insert(sdkPath); foundSDK = checkSDKPath(sdkPath); dir.cdUp(); } while (!foundSDK && !dir.isRoot()); -- libgit2 0.21.4