-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
How to check CWE-404 when throw exception #17319
Comments
@ysuLihua thanks for your question. You have a few options to consider:
These options, however, only considers intra-procedural analysis. You can extend those options to inter-procedural, but you would need to handle the calls yourself. The following query may provide a good example cpp/cert/src/rules/FIO51-CPP/CloseFilesWhenTheyAreNoLongerNeeded.ql. Let me know if this helps. |
Thank you. I'll learn about this. |
@rvermeulen thanks for your suggestions! Here's a code example:
|
Hi @ysuLihua, Unfortunately you cannot model this with data flow, because the value returned from The cpp/cert/src/rules/FIO51-CPP/CloseFilesWhenTheyAreNoLongerNeeded.ql uses control flow by finding a path using the recursive predicate reachesTermination. The predicate can be adjusted in your case by starting at the Data flow can be used to determine if the value from |
This issue is stale because it has been open 14 days with no activity. Comment or remove the |
This issue was closed because it has been inactive for 7 days. |
Description of the issue
This is test code:
test_throw.h
test_throw.cpp
How can I check fdData is closed, before throw?
The text was updated successfully, but these errors were encountered: