Add missing java.nio.file.Files methods to FileReadWrite.qll

This commit is contained in:
Marcono1234
2020-06-26 23:56:01 +02:00
parent 163257a6c5
commit f8e474f89a

View File

@@ -9,9 +9,9 @@ private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) {
cie = fileReadingExpr and cie = fileReadingExpr and
cie.getArgument(0) = fileAccess cie.getArgument(0) = fileAccess
| |
cie.getConstructedType().hasQualifiedName("java.io", "RandomAccessFile") or cie
cie.getConstructedType().hasQualifiedName("java.io", "FileReader") or .getConstructedType()
cie.getConstructedType().hasQualifiedName("java.io", "FileInputStream") .hasQualifiedName("java.io", ["RandomAccessFile", "FileReader", "FileInputStream"])
) )
or or
exists(MethodAccess ma, Method filesMethod | exists(MethodAccess ma, Method filesMethod |
@@ -22,13 +22,9 @@ private predicate fileRead(VarAccess fileAccess, Expr fileReadingExpr) {
// represented by the first argument. // represented by the first argument.
filesMethod.getDeclaringType().hasQualifiedName("java.nio.file", "Files") and filesMethod.getDeclaringType().hasQualifiedName("java.nio.file", "Files") and
fileAccess = ma.getArgument(0) and fileAccess = ma.getArgument(0) and
( filesMethod
filesMethod.hasName("readAllBytes") or .hasName(["readAllBytes", "readAllLines", "readString", "lines", "newBufferedReader",
filesMethod.hasName("readAllLines") or "newInputReader", "newByteChannel"])
filesMethod.hasName("newBufferedReader") or
filesMethod.hasName("newInputReader") or
filesMethod.hasName("newByteChannel")
)
) )
) )
or or