From b4b0f533a9d3b65ff0ac53c296d617c69f99c876 Mon Sep 17 00:00:00 2001 From: cursey Date: Mon, 27 Dec 2021 01:02:05 -0800 Subject: [PATCH] Validate vcpkg features --- src/cmake_generator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmake_generator.cpp b/src/cmake_generator.cpp index ed0d59f..ea9df19 100644 --- a/src/cmake_generator.cpp +++ b/src/cmake_generator.cpp @@ -614,6 +614,11 @@ void generate_cmake(const char *path, const parser::Project *parent_project) { if (!vcpkg_valid_identifier(package.name)) { throw std::runtime_error("Invalid vcpkg package name '" + package.name + "'"); } + for (const auto &feature : package.features) { + if (!vcpkg_valid_identifier(feature)) { + throw std::runtime_error("Invalid vcpkg package feature '" + feature + "'"); + } + } if (package.features.empty()) { ofs << " \"" << package.name << '\"'; } else {