-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Brodes/seh flow phase1 throwing models #18014
base: main
Are you sure you want to change the base?
Changes from all commits
de05aee
4b83a45
1c7b5ae
792231c
1c874d3
5bb765d
26d590a
63ddd81
0784776
ae1ed38
a69daa0
23485f1
4e77756
69df07e
6aa7412
9b2590e
4412691
7059fc3
248f1c4
583651b
66cf736
37365c7
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). | ||||||||||||
Comment on lines
+9
to
+10
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.
Suggested change
|
||||||||||||
*/ | ||||||||||||
abstract class NonCppThrowingFunction extends Function { } | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* A function that is guaranteed to never throw. | ||||||||||||
* | ||||||||||||
* DEPRECATED: use `NonCppThrowingFunction` instead. | ||||||||||||
*/ | ||||||||||||
abstract class NonThrowingFunction extends Function { } | ||||||||||||
jketema marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
deprecated class NonThrowingFunction = NonCppThrowingFunction; |
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. | ||||||||||||||||||
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. |
||||||||||||||||||
*/ | ||||||||||||||||||
abstract class ThrowingFunction extends Function { | ||||||||||||||||||
ThrowingFunction() { any() } | ||||||||||||||||||
|
||||||||||||||||||
Comment on lines
+17
to
+18
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. This doesn't seem necessary? |
||||||||||||||||||
/** | ||||||||||||||||||
* 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. | ||||||||||||||||||
*/ | ||||||||||||||||||
Comment on lines
+26
to
+30
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
|
||||||||||||||||||
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.