diff options
author | Nico Weber <nicolasweber@gmx.de> | 2013-01-03 01:40:12 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2013-01-03 01:40:12 (GMT) |
commit | 0fd3797f148a5ec1032f3a8f3b2747e8958128a0 (patch) | |
tree | 5f5e12bfac5ce98e01c56619cfbfe35f5dc2d26b /src | |
parent | 37b5ac7a1a8ca493edd863133e2e9f603c37dfa5 (diff) | |
download | Ninja-0fd3797f148a5ec1032f3a8f3b2747e8958128a0.zip Ninja-0fd3797f148a5ec1032f3a8f3b2747e8958128a0.tar.gz Ninja-0fd3797f148a5ec1032f3a8f3b2747e8958128a0.tar.bz2 |
ManifestParser constructor accesses its first argument, don't pass NULL
The constructor does
env_ = &state->bindings_;
so env_ is effectively set to offsetof(ManifestParser, bindings_). This
will blow up if env_ gets dereferenced -- this doesn't seem to happen in
these tests, but it's less confusing with this patch. Also, passing &state is
consistent with the rest of this test.
Diffstat (limited to 'src')
-rw-r--r-- | src/manifest_parser_test.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 92f52d2..4ac093f 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -295,7 +295,8 @@ TEST_F(ParserTest, ReservedWords) { TEST_F(ParserTest, Errors) { { - ManifestParser parser(NULL, NULL); + State state; + ManifestParser parser(&state, NULL); string err; EXPECT_FALSE(parser.ParseTest("foobar", &err)); EXPECT_EQ("input:1: expected '=', got eof\n" @@ -305,7 +306,8 @@ TEST_F(ParserTest, Errors) { } { - ManifestParser parser(NULL, NULL); + State state; + ManifestParser parser(&state, NULL); string err; EXPECT_FALSE(parser.ParseTest("x 3", &err)); EXPECT_EQ("input:1: expected '=', got identifier\n" @@ -315,7 +317,8 @@ TEST_F(ParserTest, Errors) { } { - ManifestParser parser(NULL, NULL); + State state; + ManifestParser parser(&state, NULL); string err; EXPECT_FALSE(parser.ParseTest("x = 3", &err)); EXPECT_EQ("input:1: unexpected EOF\n" |