-
Notifications
You must be signed in to change notification settings - Fork 62
M0-1-10
: Functions called from int32_t main() are not considered as "called"
#646
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
Comments
A possible fix strategy would be to consider Int32_t type as well for
|
Thanks for the report! For a class MainFunction extends MainLikeFunction {
MainFunction() {
hasGlobalName("main") and
(
getType().resolveTypeDefs() instanceof IntType
)
}
} This would also have the benefit of capturing |
I agree .. your proposal sounds better! Thank you for your comments! |
I was wondering how to modify the test for this rule. The test case uses the |
@lcartey : Would it be OK to have a test for this here considering that the fix is inside the library - EncapsulatingFunctions.qll? |
Library tests can be added to this directory: And, just to confirm, you will need a separate test directory for each type of |
Issue fixed with PR: #647 |
Affected rules
Description
The
class MainFunction
defined in EncapsulatingFunctions.qll doesn't considerint32_t main()
as a "main" function. Due to this, multiple false positives get raised in case the user has definedmain
withint32_t
return type.Example
Definitions of func1 and func2 are left out for reasons of brevity.
The text was updated successfully, but these errors were encountered: