Skip to content

Commit 69de17e

Browse files
authored
Merge pull request #21153 from geoffw0/splitoff
Rust: Add barrier for split_off
2 parents 8257475 + b2d19b6 commit 69de17e

File tree

3 files changed

+133
-117
lines changed

3 files changed

+133
-117
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 ModeledBarrier extends Barrier {
71+
ModeledBarrier() {
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)