Skip to content

Commit 479c58b

Browse files
committed
Rust: Add a barrier.
1 parent 7658ebb commit 479c58b

File tree

3 files changed

+177
-170
lines changed

3 files changed

+177
-170
lines changed

rust/ql/lib/codeql/rust/security/UncontrolledAllocationSizeExtensions.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,17 @@ module UncontrolledAllocationSize {
6363
branch = false
6464
)
6565
}
66+
67+
/**
68+
* A barrier for uncontrolled allocation size flow into particular functions.
69+
*/
70+
private class ModelledBarrier extends Barrier {
71+
ModelledBarrier() {
72+
exists(MethodCall c |
73+
c.getStaticTarget().getCanonicalPath() =
74+
["<alloc::string::String>::split_off", "<alloc::vec::Vec>::split_off"] and
75+
this.asExpr() = c.getAnArgument()
76+
)
77+
}
78+
}
6679
}

0 commit comments

Comments
 (0)