Rename filesystemStore predicate after d9e6e5aa04

This commit is contained in:
Tony Torralba
2022-01-17 11:13:41 +01:00
parent 500deac12d
commit ba3a4fb717

View File

@@ -33,7 +33,7 @@ class LocalFileOpenCall extends Storable {
override Expr getAStore() { override Expr getAStore() {
exists(FilesystemFlowConfig conf, DataFlow::Node n | exists(FilesystemFlowConfig conf, DataFlow::Node n |
filesystemStore(n, result) and closesFile(n, result) and
conf.hasFlow(DataFlow::exprNode(this), n) conf.hasFlow(DataFlow::exprNode(this), n)
) )
} }
@@ -57,14 +57,14 @@ private predicate isVarargs(Argument arg, DataFlow::ImplicitVarargsArray varargs
/** Holds if `store` closes `file`. */ /** Holds if `store` closes `file`. */
private predicate closesFile(DataFlow::Node file, Call closeCall) { private predicate closesFile(DataFlow::Node file, Call closeCall) {
store.getCallee() instanceof CloseFileMethod and closeCall.getCallee() instanceof CloseFileMethod and
if store.getCallee().isStatic() if closeCall.getCallee().isStatic()
then file.asExpr() = store then file.asExpr() = closeCall
else file.asExpr() = store.getQualifier() else file.asExpr() = closeCall.getQualifier()
or or
// try-with-resources automatically closes the file // try-with-resources automatically closes the file
any(TryStmt try).getAResource() = store.(LocalFileOpenCall).getEnclosingStmt() and any(TryStmt try).getAResource() = closeCall.(LocalFileOpenCall).getEnclosingStmt() and
store = file.asExpr() closeCall = file.asExpr()
} }
/** A method that closes a file, perhaps after writing some data. */ /** A method that closes a file, perhaps after writing some data. */
@@ -87,7 +87,7 @@ private class FilesystemFlowConfig extends DataFlow::Configuration {
override predicate isSink(DataFlow::Node sink) { override predicate isSink(DataFlow::Node sink) {
filesystemInput(sink, _) or filesystemInput(sink, _) or
filesystemStore(sink, _) closesFile(sink, _)
} }
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) { override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {