diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-01-10 15:19:21 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-01-13 16:23:40 +0100 |
commit | 5b2771a18e46f59062147d22cf173f50eeb014c3 (patch) | |
tree | 821151de7e31ff7216cdd63365e274827d613ee4 | |
parent | 83ce5b99d48642d929e6270fa38fe1a475275fe8 (diff) | |
download | justbuild-5b2771a18e46f59062147d22cf173f50eeb014c3.tar.gz |
just-mr setup: Fix ensuring field 'subdir' only accepts relative paths
(cherry-picked from a8b50ad395b72c6933c164d064d86d60cd6b594c)
-rw-r--r-- | src/other_tools/repo_map/repos_to_setup_map.cpp | 7 | ||||
-rw-r--r-- | src/other_tools/utils/parse_archive.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp index 351c6215..621a593a 100644 --- a/src/other_tools/repo_map/repos_to_setup_map.cpp +++ b/src/other_tools/repo_map/repos_to_setup_map.cpp @@ -104,6 +104,13 @@ void GitCheckout(ExpressionPtr const& repo_desc, ? repo_desc_subdir->String() : "") .lexically_normal(); + if (subdir.is_absolute()) { + (*logger)(fmt::format("GitCheckout: Expected field \"subdir\" to be a " + "relative path, but found {}", + subdir.string()), + /*fatal=*/true); + return; + } // check optional mirrors auto repo_desc_mirrors = repo_desc->Get("mirrors", Expression::list_t{}); std::vector<std::string> mirrors{}; diff --git a/src/other_tools/utils/parse_archive.cpp b/src/other_tools/utils/parse_archive.cpp index fb03309a..267d2d2d 100644 --- a/src/other_tools/utils/parse_archive.cpp +++ b/src/other_tools/utils/parse_archive.cpp @@ -121,6 +121,13 @@ auto ParseArchiveDescription(ExpressionPtr const& repo_desc, ? repo_desc_subdir->String() : "") .lexically_normal(); + if (subdir.is_absolute()) { + (*logger)(fmt::format("ArchiveCheckout: Expected field \"subdir\" to " + "be a relative path, but found {}", + subdir.string()), + /*fatal=*/true); + return std::nullopt; + } // check "special" pragma auto repo_desc_pragma = repo_desc->At("pragma"); |