From a87516edd643e15d3a2a51048e6b507683f63ea7 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 19 Jan 2015 21:20:15 -0800 Subject: [PATCH] Remove an incorrect assert. The assert fires on cyclic manifests (found by afl-fuzz). Since there was explicit error handing for this case already, just remove the assert. --- src/manifest_parser_test.cc | 10 ++++++++++ src/state.cc | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 6909ea9..a8f2e53 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -891,6 +891,16 @@ TEST_F(ParserTest, DefaultDefault) { EXPECT_EQ("", err); } +TEST_F(ParserTest, DefaultDefaultCycle) { + ASSERT_NO_FATAL_FAILURE(AssertParse( +"rule cat\n command = cat $in > $out\n" +"build a: cat a\n")); + + string err; + EXPECT_EQ(0u, state.DefaultNodes(&err).size()); + EXPECT_EQ("could not determine root nodes of build graph", err); +} + TEST_F(ParserTest, DefaultStatements) { ASSERT_NO_FATAL_FAILURE(AssertParse( "rule cat\n command = cat $in > $out\n" diff --git a/src/state.cc b/src/state.cc index 6e3e10d..1ceda45 100644 --- a/src/state.cc +++ b/src/state.cc @@ -187,7 +187,6 @@ vector State::RootNodes(string* err) { if (!edges_.empty() && root_nodes.empty()) *err = "could not determine root nodes of build graph"; - assert(edges_.empty() || !root_nodes.empty()); return root_nodes; } -- 2.7.4