-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Brodes/seh flow phase1 throwing models #18014
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
Changes from 22 commits
de05aee
4b83a45
1c7b5ae
792231c
1c874d3
5bb765d
26d590a
63ddd81
0784776
ae1ed38
a69daa0
23485f1
4e77756
69df07e
6aa7412
9b2590e
4412691
7059fc3
248f1c4
583651b
66cf736
37365c7
e6641e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| category: deprecated | ||
| --- | ||
| * The `NonThrowing` class (`semmle.code.cpp.models.interfaces.NonThrowing`) has been deprecated. Please use the `NonCppThrowingFunction` class instead. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| import semmle.code.cpp.models.interfaces.Throwing | ||
|
|
||
| class WindowsDriverFunction extends ThrowingFunction { | ||
| WindowsDriverFunction() { | ||
| class WindowsDriverExceptionAnnotation extends AlwaysSehThrowingFunction { | ||
| WindowsDriverExceptionAnnotation() { | ||
| this.hasGlobalName(["RaiseException", "ExRaiseAccessViolation", "ExRaiseDatatypeMisalignment"]) | ||
| } | ||
|
|
||
| final override predicate mayThrowException(boolean unconditional) { unconditional = true } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,15 @@ | |||||||||||
| import semmle.code.cpp.Function | ||||||||||||
| import semmle.code.cpp.models.Models | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * A function that is guaranteed to never throw a C++ exception | ||||||||||||
| * (distinct from a structured exception handling, SEH, exception). | ||||||||||||
|
||||||||||||
| * A function that is guaranteed to never throw a C++ exception | |
| * (distinct from a structured exception handling, SEH, exception). | |
| * A function that is guaranteed to never throw a C++ exception. | |
| * | |
| * The function may still raise a structured exception handling (SEH) exception. |
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.
Fixed
jketema marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,12 +11,21 @@ import semmle.code.cpp.models.Models | |||||||||||||||||
| import semmle.code.cpp.models.interfaces.FunctionInputsAndOutputs | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * A class that models the exceptional behavior of a function. | ||||||||||||||||||
| * A function that is known to raise an exception. | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would leave this as it was, as we're going to deprecate this anyway.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||||||||||||||||||
| */ | ||||||||||||||||||
| abstract class ThrowingFunction extends Function { | ||||||||||||||||||
| ThrowingFunction() { any() } | ||||||||||||||||||
|
|
||||||||||||||||||
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Holds if this function may throw an exception during evaluation. | ||||||||||||||||||
| * If `unconditional` is `true` the function always throws an exception. | ||||||||||||||||||
| */ | ||||||||||||||||||
| abstract predicate mayThrowException(boolean unconditional); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * A function that is known to raise an exception unconditionally. | ||||||||||||||||||
| * The only cases known where this happens is for SEH | ||||||||||||||||||
| * (structured exception handling) exceptions. | ||||||||||||||||||
| */ | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since "SEH" is in the name of the class, I would change this to just:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||||||||||||||||||
| abstract class AlwaysSehThrowingFunction extends Function { } | ||||||||||||||||||
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 think we should be able to remove this predicate completely, but let's leave that as a follow up.
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.
Leaving it until the next iteration.