Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfault on edge with no inputs #1291

Merged
merged 1 commit into from
Jun 18, 2017
Merged

Conversation

colincross
Copy link
Contributor

PR #1281 added a deference of most_recent_input without checking
for NULL, which can occur if a build rule has no inputs.
Check it for null before dereferencing, and add a test.

Fixes #1290.

@bradking
Copy link
Contributor

I can confirm that this fixes the case I reported. However, with assertions enabled (e.g. configure.py --debug) the new test fails:

BuildWithLogTest.RebuildWithNoInputsninja_test: src/build.cc:661: bool Builder::Build(std::__cxx11::string*): Assertion `!AlreadyUpToDate()' failed.
Aborted

PR ninja-build#1281 added a deference of most_recent_input without checking
for NULL, which can occur if a build rule has no inputs.
Check it for null before dereferencing, and add a test.

Fixes ninja-build#1290.
@colincross
Copy link
Contributor Author

I updated the test to have two outputs, one if which will rebuild on the second build so that AlreadyUpToDate() is false.

@nico nico merged commit 1029064 into ninja-build:master Jun 18, 2017
@nico
Copy link
Collaborator

nico commented Jun 18, 2017

Thanks Brad for the report, and Colin for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants