C++: Add a new model class describing pure memory functions, and use this new model in DefaultSafeExternalAPIFunction.

This commit is contained in:
Mathias Vorreiter Pedersen
2020-11-18 12:47:33 +01:00
parent 09c5caa3bd
commit 715f233360
3 changed files with 59 additions and 2 deletions

View File

@@ -12,5 +12,9 @@ abstract class SafeExternalAPIFunction extends Function { }
/** The default set of "safe" external APIs. */
private class DefaultSafeExternalAPIFunction extends SafeExternalAPIFunction {
DefaultSafeExternalAPIFunction() { this.hasGlobalName(["strcmp", "strlen", "memcmp"]) }
DefaultSafeExternalAPIFunction() {
this instanceof PureStrFunction or
this instanceof StrLenFunction or
this instanceof PureMemFunction
}
}

View File

@@ -12,5 +12,9 @@ abstract class SafeExternalAPIFunction extends Function { }
/** The default set of "safe" external APIs. */
private class DefaultSafeExternalAPIFunction extends SafeExternalAPIFunction {
DefaultSafeExternalAPIFunction() { this.hasGlobalName(["strcmp", "strlen", "memcmp"]) }
DefaultSafeExternalAPIFunction() {
this instanceof PureStrFunction or
this instanceof StrLenFunction or
this instanceof PureMemFunction
}
}