Skip to content

Commit 4e418d3

Browse files
committed
Rust: Update for latest main, and autoformat.
1 parent de042ea commit 4e418d3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

rust/ql/lib/codeql/rust/frameworks/RustCrypto.qll

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,26 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range, Data
2222
StreamCipherInit() {
2323
// a call to `cipher::KeyInit::new`, `cipher::KeyInit::new_from_slice`,
2424
// `cipher::KeyIvInit::new`, `cipher::KeyIvInit::new_from_slices` or `rc2::Rc2::new_with_eff_key_len`.
25-
exists(Path p, string rawAlgorithmName |
26-
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getPath() = p and
25+
exists(PathExpr p, string rawAlgorithmName |
26+
this.asExpr().getExpr().(CallExpr).getFunction() = p and
2727
p.getResolvedCrateOrigin().matches("%/RustCrypto%") and
28-
p.getPart().getNameRef().getText() =
28+
p.getPath().getPart().getNameRef().getText() =
2929
["new", "new_from_slice", "new_from_slices", "new_with_eff_key_len"] and
3030
(
31-
rawAlgorithmName = p.getQualifier().getPart().getNameRef().getText() or
32-
rawAlgorithmName = p.getQualifier().getPart().getGenericArgList().getGenericArg(0).(TypeArg).getTy().(PathType).getPath().getPart().getNameRef().getText()
31+
rawAlgorithmName = p.getPath().getQualifier().getPart().getNameRef().getText() or
32+
rawAlgorithmName =
33+
p.getPath()
34+
.getQualifier()
35+
.getPart()
36+
.getGenericArgList()
37+
.getGenericArg(0)
38+
.(TypeArg)
39+
.getTypeRepr()
40+
.(PathTypeRepr)
41+
.getPath()
42+
.getPart()
43+
.getNameRef()
44+
.getText()
3345
) and
3446
algorithmName = simplifyAlgorithmName(rawAlgorithmName)
3547
)

0 commit comments

Comments
 (0)