Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: tools/gn/action_target_generator.cc

Issue 2627703002: Validate GN substitutions in args and rsp files. (Closed)
Patch Set: Format Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/nocompile.gni ('k') | tools/gn/action_target_generator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/action_target_generator.cc
diff --git a/tools/gn/action_target_generator.cc b/tools/gn/action_target_generator.cc
index 6f962b6dd2a4379fe0576baa4422ca7165364cfb..5c7cbf67a8de2093676daea83feccdd8b38d6016 100644
--- a/tools/gn/action_target_generator.cc
+++ b/tools/gn/action_target_generator.cc
@@ -117,15 +117,32 @@ bool ActionTargetGenerator::FillScript() {
bool ActionTargetGenerator::FillScriptArgs() {
const Value* value = scope_->GetValue(variables::kArgs, true);
if (!value)
- return true;
- return target_->action_values().args().Parse(*value, err_);
+ return true; // Nothing to do.
+
+ if (!target_->action_values().args().Parse(*value, err_))
+ return false;
+ if (!EnsureValidSubstitutions(
+ target_->action_values().args().required_types(),
+ &IsValidScriptArgsSubstitution,
+ value->origin(), err_))
+ return false;
+
+ return true;
}
bool ActionTargetGenerator::FillResponseFileContents() {
const Value* value = scope_->GetValue(variables::kResponseFileContents, true);
if (!value)
- return true;
- return target_->action_values().rsp_file_contents().Parse(*value, err_);
+ return true; // Nothing to do.
+
+ if (!target_->action_values().rsp_file_contents().Parse(*value, err_))
+ return false;
+ if (!EnsureValidSubstitutions(
+ target_->action_values().rsp_file_contents().required_types(),
+ &IsValidSourceSubstitution, value->origin(), err_))
+ return false;
+
+ return true;
}
bool ActionTargetGenerator::FillDepfile() {
« no previous file with comments | « build/nocompile.gni ('k') | tools/gn/action_target_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698