-
Notifications
You must be signed in to change notification settings - Fork 20
Jb1/ap1 maturity #315
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
base: main
Are you sure you want to change the base?
Jb1/ap1 maturity #315
Conversation
…to a more precise ignorable operation analysis. Ignorable operations that flow to a possible source also invalidate that source. Also added a root source finder to get the earliest source if many exist. Modified the leap year checker finder to use a new dataflow mechanic that flows from a YearFieldAccess.
… constant being a literal, but a known value variable or literal.
… ignore certain opeartions. Also added an ignorable function class to be used to ignore operation sources.
…ure they are actually necessary or providing much utility.
…iewing the unit tests and conversations about how to handle some of the fp/fn cases observed. Updated the unit tests to use InlineExpectationsTestQuery.ql so it is easier to detect FP/FNs.
…eds to be generally reassessed but recent test changes alter the expected results.
…se positive we currently do not have a solution for, marked as SPURIOUS.
… for handing mktime and other variants that convert the time automatically without the need for a check if the date is an incorrect leap year date.
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Show resolved
Hide resolved
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Show resolved
Hide resolved
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Show resolved
Hide resolved
…ification.ql Co-authored-by: Josh Brown <jb1@microsoft.com>
…ification.ql Co-authored-by: Josh Brown <jb1@microsoft.com>
…ification.ql Co-authored-by: Josh Brown <jb1@microsoft.com>
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Outdated
Show resolved
Hide resolved
…ification.ql Co-authored-by: Josh Brown <jb1@microsoft.com>
…into jb1/ap1-maturity
…ear dates without needing to be checked.
MathiasVP
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of comments! I've tried to anticipate some of the things that GitHub would probably like to see fixed. I'm sure they will have other comments, but this should at least shave off the first round of review comments 😄
|
|
||
| /** | ||
| * A `DayFieldAccess` for the `TIME_FIELDS` struct. | ||
| */ | ||
| class TimeFieldsDayFieldAccess extends DayFieldAccess { | ||
| TimeFieldsDayFieldAccess() { this.getTarget().getName() = "Day" } | ||
| } | ||
|
|
||
| /** | ||
| * A `MonthFieldAccess` for the `TIME_FIELDS` struct. | ||
| */ | ||
| class TimeFieldsMonthFieldAccess extends MonthFieldAccess { | ||
| TimeFieldsMonthFieldAccess() { this.getTarget().getName() = "Month" } | ||
| } | ||
|
|
||
| /** | ||
| * A `YearFieldAccess` for the `TIME_FIELDS` struct. | ||
| */ | ||
| class TimeFieldsYearFieldAccess extends YearFieldAccess { | ||
| TimeFieldsYearFieldAccess() { this.getTarget().getName() = "Year" } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally these should all be private, but I see that the old StructTmYearFieldAccess and friends also aren't private so 🤷
Should we also check for the declaring types here? i.e., add something like:
this.getTarget().getDeclaringType().hasGlobalName("_TIME_FIELDS")?(note the underscore in front)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to match the existing approach here, and none of the others do this, so I'm inclined to leave it and such a change should be a separate PR.
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Outdated
Show resolved
Hide resolved
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Outdated
Show resolved
Hide resolved
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Show resolved
Hide resolved
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Outdated
Show resolved
Hide resolved
cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
Show resolved
Hide resolved
…ification.ql Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
…ification.ql Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
…ification.ql Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
…ification.ql Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
…into jb1/ap1-maturity
…utoLeapYearCorrecting. Updating expected results.
False positive clean up for cpp/microsoft/public/leap-year/unchecked-after-arithmetic-year-modification.