summaryrefslogtreecommitdiffstats
path: root/src/dyndep_parser.cc
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-03 21:16:20 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-04 15:17:46 (GMT)
commitf2f62e295ad1254b7e3cdd5d78fa8afb0e86f1ce (patch)
tree8a716b65a2bb7245ad43e902ad0b6ffb21fe9fc7 /src/dyndep_parser.cc
parentc573f6b8b23593f46a08616b76325d3ce0175002 (diff)
downloadNinja-f2f62e295ad1254b7e3cdd5d78fa8afb0e86f1ce.zip
Ninja-f2f62e295ad1254b7e3cdd5d78fa8afb0e86f1ce.tar.gz
Ninja-f2f62e295ad1254b7e3cdd5d78fa8afb0e86f1ce.tar.bz2
Add explicit "empty path" errors before calling CanonicalizePath
Update call sites that might have empty paths to explicitly check for them before calling CanonicalizePath. Note that the depfile parser ensures all parsed outs and deps are non-empty.
Diffstat (limited to 'src/dyndep_parser.cc')
-rw-r--r--src/dyndep_parser.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dyndep_parser.cc b/src/dyndep_parser.cc
index 56da16f..45d1c31 100644
--- a/src/dyndep_parser.cc
+++ b/src/dyndep_parser.cc
@@ -115,6 +115,8 @@ bool DyndepParser::ParseEdge(string* err) {
return lexer_.Error("expected path", err);
string path = out0.Evaluate(&env_);
+ if (path.empty())
+ return lexer_.Error("empty path", err);
string path_err;
uint64_t slash_bits;
if (!CanonicalizePath(&path, &slash_bits, &path_err))
@@ -202,6 +204,8 @@ bool DyndepParser::ParseEdge(string* err) {
dyndeps->implicit_inputs_.reserve(ins.size());
for (vector<EvalString>::iterator i = ins.begin(); i != ins.end(); ++i) {
string path = i->Evaluate(&env_);
+ if (path.empty())
+ return lexer_.Error("empty path", err);
string path_err;
uint64_t slash_bits;
if (!CanonicalizePath(&path, &slash_bits, &path_err))
@@ -213,6 +217,8 @@ bool DyndepParser::ParseEdge(string* err) {
dyndeps->implicit_outputs_.reserve(outs.size());
for (vector<EvalString>::iterator i = outs.begin(); i != outs.end(); ++i) {
string path = i->Evaluate(&env_);
+ if (path.empty())
+ return lexer_.Error("empty path", err);
string path_err;
uint64_t slash_bits;
if (!CanonicalizePath(&path, &slash_bits, &path_err))