mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Fix spurious source models for primitive types in framework mode.
This commit is contained in:
@@ -38,18 +38,15 @@ newtype TFrameworkModeEndpoint =
|
|||||||
} or
|
} or
|
||||||
TOverridableParameter(Method m, Parameter p) {
|
TOverridableParameter(Method m, Parameter p) {
|
||||||
AutomodelJavaUtil::isFromSource(p) and
|
AutomodelJavaUtil::isFromSource(p) and
|
||||||
|
not AutomodelJavaUtil::isUnexploitableType(p.getType()) and
|
||||||
p.getCallable() = m and
|
p.getCallable() = m and
|
||||||
m instanceof ModelExclusions::ModelApi and
|
m instanceof ModelExclusions::ModelApi and
|
||||||
not m.getDeclaringType().isFinal() and
|
AutomodelJavaUtil::isOverridable(m)
|
||||||
not m.isFinal() and
|
|
||||||
not m.isStatic()
|
|
||||||
} or
|
} or
|
||||||
TOverridableQualifier(Method m) {
|
TOverridableQualifier(Method m) {
|
||||||
AutomodelJavaUtil::isFromSource(m) and
|
AutomodelJavaUtil::isFromSource(m) and
|
||||||
m instanceof ModelExclusions::ModelApi and
|
m instanceof ModelExclusions::ModelApi and
|
||||||
not m.getDeclaringType().isFinal() and
|
AutomodelJavaUtil::isOverridable(m)
|
||||||
not m.isFinal() and
|
|
||||||
not m.isStatic()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -111,3 +111,12 @@ predicate isUnexploitableType(Type tp) {
|
|||||||
tp instanceof NumberType or
|
tp instanceof NumberType or
|
||||||
tp instanceof VoidType
|
tp instanceof VoidType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if the given method can be overridden, that is, it is not final,
|
||||||
|
* static, or private.
|
||||||
|
*/
|
||||||
|
predicate isOverridable(Method m) {
|
||||||
|
not m.getDeclaringType().isFinal() and not m.isFinal() and
|
||||||
|
not m.isStatic() and not m.isPrivate()
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ public class File {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setLastModified(long time) { // $ sinkModel=setLastModified(long):Argument[this] sourceModel=setLastModified(long):Parameter[this] SPURIOUS: sourceModel=setLastModified(long):Parameter[0] // time is not a candidate (primitive type)
|
public boolean setLastModified(long time) { // $ sinkModel=setLastModified(long):Argument[this] sourceModel=setLastModified(long):Parameter[this] // time is not a candidate (primitive type)
|
||||||
return false;
|
return false;
|
||||||
} // return value is not a source candidate because it's a primitive
|
} // return value is not a source candidate because it's a primitive
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user