Skip to content

Commit 9eaf495

Browse files
committed
Rust: Add trait mode for char::from_u32 and a couple of similar methods.
1 parent a8147d0 commit 9eaf495

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

rust/ql/lib/codeql/rust/frameworks/stdlib/core.model.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ extensions:
2929
- ["<_ as core::convert::TryInto>::try_into", "Argument[self].Reference.Element", "ReturnValue.Field[core::result::Result::Ok(0)].Element", "taint", "manual"]
3030
- ["<_ as core::convert::AsMut>::as_mut", "Argument[self]", "ReturnValue", "value", "manual"]
3131
- ["<_ as core::convert::AsRef>::as_ref", "Argument[self]", "ReturnValue", "value", "manual"]
32+
- ["core::char::from_digit", "Argument[0]", "ReturnValue.Field[core::option::Option::Some(0)]", "taint", "manual"]
33+
- ["core::char::from_u32", "Argument[0]", "ReturnValue.Field[core::option::Option::Some(0)]", "taint", "manual"]
34+
- ["core::char::from_u32_unchecked", "Argument[0]", "ReturnValue", "taint", "manual"]
3235
# Iterator
3336
- ["<core::result::Result>::iter", "Argument[self].Element", "ReturnValue.Element", "value", "manual"]
3437
- ["<_ as value_trait::array::Array>::iter", "Argument[self].Element", "ReturnValue.Element", "value", "manual"]

rust/ql/test/library-tests/dataflow/local/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ fn conversions() {
576576
sink(i64::from(b)); // $ hasTaintFlow=51
577577

578578
let c: char = std::char::from_u32(source(52) as u32).unwrap();
579-
sink(c as i64); // $ MISSING: hasTaintFlow=52
579+
sink(c as i64); // $ hasTaintFlow=52
580580
}
581581

582582
fn clone() {

0 commit comments

Comments
 (0)