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

DM-19690: audit for ast error-checking #52

Merged
merged 1 commit into from May 16, 2019
Merged

Conversation

PaulPrice
Copy link
Contributor

Added assertOK() where it had been left out. This is C code, so
it needs to be done after every astXXX function call, except for
a few (e.g., astAnnul) and where it's in a destructor. Otherwise,
the ast global error state can be set, we don't realise it, and
the error appears to come out of somewhere else.

Added assertOK() where it had been left out. This is C code, so
it needs to be done after every astXXX function call, except for
a few (e.g., astAnnul) and where it's in a destructor. Otherwise,
the ast global error state can be set, we don't realise it, and
the error appears to come out of somewhere else.
Copy link
Contributor

@r-owen r-owen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have put in a lot of assertOK that are not needed. I'd like to know which one was missing that allowed the bug in question.

"%s", options.c_str()))) {}
"%s", options.c_str()))) {
assertOK();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant because the Frame constructor calls the Mapping constructor which calls assertOK, and after that is called no AST code is executed that can set the flag. I admit that astIsA<x> is often called in these constructors, but:

  • I don't think that can set the OK flag false
  • Even if it can, this would only happen if it returned false, and at that point it's too late to call assertOK as an exception is already being raised

Where was the missing assertOK that triggered this bug? I think almost all the ones you added are redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not followed the code paths, but I put assertOK calls after any ast* calls (except for astIsA*). I figure it's better to be more careful than less careful, because it's a cheap test and if anything is missed, it manifests as a completely weird bug, and takes a full day of mucking around with gdb to understand it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good answer. OK. Go ahead.

@PaulPrice PaulPrice merged commit f403422 into master May 16, 2019
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

2 participants