mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Add missing java.nio.file.Files methods to FileReadWrite.qll
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user