-
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
CPP: Add a query to find incorrectly used exceptions. 2 #6141
Conversation
forgot the results |
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.
Thank you for your contribution! I have a few questions as I'd like to understand what the query is looking for a bit better.
cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.cpp
Outdated
Show resolved
Hide resolved
cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.ql
Outdated
Show resolved
Hide resolved
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests/test.cpp
Show resolved
Hide resolved
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests/test.cpp
Show resolved
Hide resolved
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.cpp
Show resolved
Hide resolved
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.
Happy to merge this into experimental.
If we want to promote it from experimental at some point, we may want to consider each of the three parts of the query separately.
I did an LGTM run here: https://lgtm.com/query/2396602394896819437/ . Some good results, some that appear to be the intended design (in particular when an exception object is saved to a variable apparently so that it can be thrown later if there's a problem). All results were for the |
interesting FP. this was not in my kits. thanks to. I will suggest a solution. relative to the detector.
|
to remove the FP you discovered, I suggest using: not fc.getParent() instanceof Initializer and I also propose to discuss three points (as you think):
|
I believe it's using placement new to essentially simulate assigning the exception value to
This seems like a strange design which defeats the point of exceptions (that you can
Again I'm not exactly sure what that code is trying to do. I don't think this case is especially important, but if you think lambda's should be an exception you could exclude results inside a |
Good afternoon @geoffw0. |
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.
Happy to merge this in its current state.
Newer LGTM run: https://lgtm.com/query/7864086823722766951/ |
Good day.
this is an attempt to fix problems introduced in 6082.
in this request I am looking for errors when using exceptions.
I have identified 2 main areas:
1.the ability to throw unhandled exceptions in the body of the
DllMain
function. from which the library code will not be unloaded.2. creating an exception object without throwing the last one, or a rather strange construction of an exception.