Skip to content

Commit e841479

Browse files
committed
TestCaseReader: Disallow UNC paths along with absolute ones
1 parent 34425c3 commit e841479

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/TestCaseReader.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ pair<SourceMap, size_t> TestCaseReader::parseSourcesAndSettingsWithLineNumber(is
159159
soltestAssert(!externalSourceName.empty(), "");
160160
fs::path externalSourceTarget(externalSourceString);
161161
fs::path testCaseParentDir = m_fileName.parent_path();
162-
if (!externalSourceTarget.is_relative())
162+
if (!externalSourceTarget.is_relative() || !externalSourceTarget.root_path().empty())
163+
// NOTE: UNC paths (ones starting with // or \\) are considered relative by Boost
164+
// since they have an empty root directory (but non-empty root name).
163165
BOOST_THROW_EXCEPTION(runtime_error("External Source paths need to be relative to the location of the test case."));
164166
fs::path externalSourceFullPath = testCaseParentDir / externalSourceTarget;
165167
string externalSourceContent;

0 commit comments

Comments
 (0)