diff --git a/rust/ql/lib/change-notes/2026-02-26-neutral-models-map-from.md b/rust/ql/lib/change-notes/2026-02-26-neutral-models-map-from.md new file mode 100644 index 000000000000..99c313c2ca23 --- /dev/null +++ b/rust/ql/lib/change-notes/2026-02-26-neutral-models-map-from.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* Added neutral models to inhibit spurious generated sink models for `map` and `from`. This fixes some false positive query results. diff --git a/rust/ql/lib/codeql/rust/frameworks/stdlib/alloc.model.yml b/rust/ql/lib/codeql/rust/frameworks/stdlib/alloc.model.yml index 74432649bd83..78d1cbdec29e 100644 --- a/rust/ql/lib/codeql/rust/frameworks/stdlib/alloc.model.yml +++ b/rust/ql/lib/codeql/rust/frameworks/stdlib/alloc.model.yml @@ -55,4 +55,14 @@ extensions: - ["::add", "Argument[0].Reference", "ReturnValue", "taint", "manual"] # Vec - ["alloc::vec::from_elem", "Argument[0]", "ReturnValue.Element", "value", "manual"] - - ["::deref", "Argument[self].Reference.Element", "ReturnValue.Reference.Element", "value", "manual"] \ No newline at end of file + - ["::deref", "Argument[self].Reference.Element", "ReturnValue.Reference.Element", "value", "manual"] + - addsTo: + pack: codeql/rust-all + extensible: neutralModel + data: + - ["::from", "sink", "manual"] + - ["::from", "sink", "manual"] + - ["::from", "sink", "manual"] + - ["::from", "sink", "manual"] + - ["::split_off", "sink", "manual"] + - ["::split_off", "sink", "manual"] diff --git a/rust/ql/lib/codeql/rust/frameworks/stdlib/core.model.yml b/rust/ql/lib/codeql/rust/frameworks/stdlib/core.model.yml index c81926a607b3..11a90cbe8ba1 100644 --- a/rust/ql/lib/codeql/rust/frameworks/stdlib/core.model.yml +++ b/rust/ql/lib/codeql/rust/frameworks/stdlib/core.model.yml @@ -102,6 +102,9 @@ extensions: - ["<_ as core::iter::traits::iterator::Iterator>::chain", "Argument[self]", "ReturnValue", "taint", "manual"] - ["<_ as core::iter::traits::iterator::Iterator>::chain", "Argument[0]", "ReturnValue", "taint", "manual"] - ["<_ as core::iter::traits::iterator::Iterator>::take", "Argument[self]", "ReturnValue", "taint", "manual"] + # Option + - ["::map", "Argument[self]", "Argument[0].Parameter[0]", "taint", "manual"] + - ["::map", "Argument[0].ReturnValue", "ReturnValue", "taint", "manual"] # Pin - ["::new", "Argument[0]", "ReturnValue.Field[core::pin::Pin::pointer]", "value", "manual"] # This model is not precise, but helps in cases where a `Pin` is implicitly dereferenced. @@ -157,6 +160,12 @@ extensions: - ["core::ptr::write_bytes", "Argument[0]", "pointer-access", "manual"] - ["core::ptr::write_unaligned", "Argument[0]", "pointer-access", "manual"] - ["core::ptr::write_volatile", "Argument[0]", "pointer-access", "manual"] + - addsTo: + pack: codeql/rust-all + extensible: neutralModel + data: + - ["::map", "sink", "manual"] + - ["::from", "sink", "manual"] - addsTo: pack: codeql/rust-all extensible: excludeFieldTaintStep diff --git a/rust/ql/lib/codeql/rust/security/UncontrolledAllocationSizeExtensions.qll b/rust/ql/lib/codeql/rust/security/UncontrolledAllocationSizeExtensions.qll index 0390ca779328..c6251563ea6f 100644 --- a/rust/ql/lib/codeql/rust/security/UncontrolledAllocationSizeExtensions.qll +++ b/rust/ql/lib/codeql/rust/security/UncontrolledAllocationSizeExtensions.qll @@ -63,17 +63,4 @@ module UncontrolledAllocationSize { branch = false ) } - - /** - * A barrier for uncontrolled allocation size flow into particular functions. - */ - private class ModeledBarrier extends Barrier { - ModeledBarrier() { - exists(MethodCall c | - c.getStaticTarget().getCanonicalPath() = - ["::split_off", "::split_off"] and - this.asExpr() = c.getAnArgument() - ) - } - } } diff --git a/rust/ql/test/query-tests/security/CWE-117/Cargo.lock b/rust/ql/test/query-tests/security/CWE-117/Cargo.lock index a4c67f043d02..7629f8fa2fe3 100644 --- a/rust/ql/test/query-tests/security/CWE-117/Cargo.lock +++ b/rust/ql/test/query-tests/security/CWE-117/Cargo.lock @@ -34,6 +34,58 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "axum" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" +dependencies = [ + "axum-core", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "backtrace" version = "0.3.75" @@ -339,6 +391,12 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + [[package]] name = "humantime" version = "2.2.0" @@ -358,6 +416,7 @@ dependencies = [ "http", "http-body", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -592,6 +651,12 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "memchr" version = "2.7.5" @@ -951,18 +1016,27 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -981,6 +1055,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1111,6 +1196,7 @@ dependencies = [ name = "test" version = "0.0.1" dependencies = [ + "axum", "env_logger", "log", "reqwest", @@ -1138,9 +1224,21 @@ dependencies = [ "mio", "pin-project-lite", "socket2", + "tokio-macros", "windows-sys 0.52.0", ] +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tokio-native-tls" version = "0.3.1" @@ -1174,6 +1272,28 @@ dependencies = [ "tokio", ] +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" version = "0.3.3" @@ -1186,6 +1306,7 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ + "log", "pin-project-lite", "tracing-core", ] diff --git a/rust/ql/test/query-tests/security/CWE-117/LogInjection.expected b/rust/ql/test/query-tests/security/CWE-117/LogInjection.expected index e326a87c42d8..4bc2d78c56cb 100644 --- a/rust/ql/test/query-tests/security/CWE-117/LogInjection.expected +++ b/rust/ql/test/query-tests/security/CWE-117/LogInjection.expected @@ -9,18 +9,19 @@ | main.rs:30:5:30:9 | ...::log | main.rs:8:29:8:37 | ...::args | main.rs:30:5:30:9 | ...::log | Log entry depends on a $@. | main.rs:8:29:8:37 | ...::args | user-provided value | | main.rs:30:5:30:9 | ...::log | main.rs:11:23:11:44 | ...::get | main.rs:30:5:30:9 | ...::log | Log entry depends on a $@. | main.rs:11:23:11:44 | ...::get | user-provided value | | main.rs:66:5:66:9 | ...::log | main.rs:8:29:8:37 | ...::args | main.rs:66:5:66:9 | ...::log | Log entry depends on a $@. | main.rs:8:29:8:37 | ...::args | user-provided value | -| main.rs:112:9:112:13 | ...::log | main.rs:109:25:109:38 | ...::args | main.rs:112:9:112:13 | ...::log | Log entry depends on a $@. | main.rs:109:25:109:38 | ...::args | user-provided value | -| main.rs:113:9:113:13 | ...::log | main.rs:109:25:109:38 | ...::args | main.rs:113:9:113:13 | ...::log | Log entry depends on a $@. | main.rs:109:25:109:38 | ...::args | user-provided value | -| main.rs:114:9:114:14 | ...::log | main.rs:109:25:109:38 | ...::args | main.rs:114:9:114:14 | ...::log | Log entry depends on a $@. | main.rs:109:25:109:38 | ...::args | user-provided value | -| main.rs:115:9:115:14 | ...::log | main.rs:109:25:109:38 | ...::args | main.rs:115:9:115:14 | ...::log | Log entry depends on a $@. | main.rs:109:25:109:38 | ...::args | user-provided value | -| main.rs:116:9:116:14 | ...::log | main.rs:109:25:109:38 | ...::args | main.rs:116:9:116:14 | ...::log | Log entry depends on a $@. | main.rs:109:25:109:38 | ...::args | user-provided value | -| main.rs:119:9:119:13 | ...::log | main.rs:109:25:109:38 | ...::args | main.rs:119:9:119:13 | ...::log | Log entry depends on a $@. | main.rs:109:25:109:38 | ...::args | user-provided value | -| main.rs:126:9:126:16 | ...::_print | main.rs:123:25:123:37 | ...::var | main.rs:126:9:126:16 | ...::_print | Log entry depends on a $@. | main.rs:123:25:123:37 | ...::var | user-provided value | -| main.rs:127:9:127:17 | ...::_eprint | main.rs:123:25:123:37 | ...::var | main.rs:127:9:127:17 | ...::_eprint | Log entry depends on a $@. | main.rs:123:25:123:37 | ...::var | user-provided value | +| main.rs:114:9:114:13 | ...::log | main.rs:111:25:111:38 | ...::args | main.rs:114:9:114:13 | ...::log | Log entry depends on a $@. | main.rs:111:25:111:38 | ...::args | user-provided value | +| main.rs:115:9:115:13 | ...::log | main.rs:111:25:111:38 | ...::args | main.rs:115:9:115:13 | ...::log | Log entry depends on a $@. | main.rs:111:25:111:38 | ...::args | user-provided value | +| main.rs:116:9:116:14 | ...::log | main.rs:111:25:111:38 | ...::args | main.rs:116:9:116:14 | ...::log | Log entry depends on a $@. | main.rs:111:25:111:38 | ...::args | user-provided value | +| main.rs:117:9:117:14 | ...::log | main.rs:111:25:111:38 | ...::args | main.rs:117:9:117:14 | ...::log | Log entry depends on a $@. | main.rs:111:25:111:38 | ...::args | user-provided value | +| main.rs:118:9:118:14 | ...::log | main.rs:111:25:111:38 | ...::args | main.rs:118:9:118:14 | ...::log | Log entry depends on a $@. | main.rs:111:25:111:38 | ...::args | user-provided value | +| main.rs:121:9:121:13 | ...::log | main.rs:111:25:111:38 | ...::args | main.rs:121:9:121:13 | ...::log | Log entry depends on a $@. | main.rs:111:25:111:38 | ...::args | user-provided value | +| main.rs:132:9:132:16 | ...::_print | main.rs:129:25:129:37 | ...::var | main.rs:132:9:132:16 | ...::_print | Log entry depends on a $@. | main.rs:129:25:129:37 | ...::var | user-provided value | +| main.rs:133:9:133:17 | ...::_eprint | main.rs:129:25:129:37 | ...::var | main.rs:133:9:133:17 | ...::_eprint | Log entry depends on a $@. | main.rs:129:25:129:37 | ...::var | user-provided value | +| main.rs:145:9:145:16 | ...::_print | main.rs:152:28:152:30 | get | main.rs:145:9:145:16 | ...::_print | Log entry depends on a $@. | main.rs:152:28:152:30 | get | user-provided value | edges | main.rs:8:9:8:12 | args [element] | main.rs:9:20:9:23 | args [element] | provenance | | -| main.rs:8:29:8:37 | ...::args | main.rs:8:29:8:39 | ...::args(...) [element] | provenance | Src:MaD:5 | -| main.rs:8:29:8:39 | ...::args(...) [element] | main.rs:8:29:8:49 | ... .collect() [element] | provenance | MaD:9 | +| main.rs:8:29:8:37 | ...::args | main.rs:8:29:8:39 | ...::args(...) [element] | provenance | Src:MaD:6 | +| main.rs:8:29:8:39 | ...::args(...) [element] | main.rs:8:29:8:49 | ... .collect() [element] | provenance | MaD:10 | | main.rs:8:29:8:49 | ... .collect() [element] | main.rs:8:9:8:12 | args [element] | provenance | | | main.rs:9:9:9:16 | username | main.rs:15:11:15:36 | MacroExpr | provenance | | | main.rs:9:9:9:16 | username | main.rs:18:12:18:37 | MacroExpr | provenance | | @@ -28,21 +29,21 @@ edges | main.rs:9:9:9:16 | username | main.rs:26:55:26:62 | username | provenance | | | main.rs:9:9:9:16 | username | main.rs:30:11:30:66 | MacroExpr | provenance | | | main.rs:9:9:9:16 | username | main.rs:52:29:52:36 | username | provenance | | -| main.rs:9:20:9:23 | args [element] | main.rs:9:20:9:30 | args.get(...) [Some, &ref] | provenance | MaD:12 | -| main.rs:9:20:9:30 | args.get(...) [Some, &ref] | main.rs:9:20:9:64 | ... .unwrap_or(...) [&ref] | provenance | MaD:13 | -| main.rs:9:20:9:64 | ... .unwrap_or(...) [&ref] | main.rs:9:20:9:72 | ... .clone() | provenance | MaD:8 | +| main.rs:9:20:9:23 | args [element] | main.rs:9:20:9:30 | args.get(...) [Some, &ref] | provenance | MaD:13 | +| main.rs:9:20:9:30 | args.get(...) [Some, &ref] | main.rs:9:20:9:64 | ... .unwrap_or(...) [&ref] | provenance | MaD:16 | +| main.rs:9:20:9:64 | ... .unwrap_or(...) [&ref] | main.rs:9:20:9:72 | ... .clone() | provenance | MaD:9 | | main.rs:9:20:9:72 | ... .clone() | main.rs:9:9:9:16 | username | provenance | | | main.rs:10:9:10:18 | user_input | main.rs:16:11:16:44 | MacroExpr | provenance | | | main.rs:10:9:10:18 | user_input | main.rs:19:12:19:39 | MacroExpr | provenance | | -| main.rs:10:22:10:34 | ...::var | main.rs:10:22:10:48 | ...::var(...) [Ok] | provenance | Src:MaD:6 | -| main.rs:10:22:10:48 | ...::var(...) [Ok] | main.rs:10:22:10:81 | ... .unwrap_or(...) | provenance | MaD:16 | +| main.rs:10:22:10:34 | ...::var | main.rs:10:22:10:48 | ...::var(...) [Ok] | provenance | Src:MaD:7 | +| main.rs:10:22:10:48 | ...::var(...) [Ok] | main.rs:10:22:10:81 | ... .unwrap_or(...) | provenance | MaD:19 | | main.rs:10:22:10:81 | ... .unwrap_or(...) | main.rs:10:9:10:18 | user_input | provenance | | | main.rs:11:9:11:19 | remote_data | main.rs:17:12:17:46 | MacroExpr | provenance | | | main.rs:11:9:11:19 | remote_data | main.rs:30:11:30:66 | MacroExpr | provenance | | -| main.rs:11:23:11:44 | ...::get | main.rs:11:23:11:71 | ...::get(...) [Ok] | provenance | Src:MaD:4 | -| main.rs:11:23:11:71 | ...::get(...) [Ok] | main.rs:11:23:12:17 | ... .unwrap() | provenance | MaD:15 | -| main.rs:11:23:12:17 | ... .unwrap() | main.rs:11:23:12:24 | ... .text() [Ok] | provenance | MaD:18 | -| main.rs:11:23:12:24 | ... .text() [Ok] | main.rs:11:23:12:61 | ... .unwrap_or(...) | provenance | MaD:16 | +| main.rs:11:23:11:44 | ...::get | main.rs:11:23:11:71 | ...::get(...) [Ok] | provenance | Src:MaD:5 | +| main.rs:11:23:11:71 | ...::get(...) [Ok] | main.rs:11:23:12:17 | ... .unwrap() | provenance | MaD:18 | +| main.rs:11:23:12:17 | ... .unwrap() | main.rs:11:23:12:24 | ... .text() [Ok] | provenance | MaD:21 | +| main.rs:11:23:12:24 | ... .text() [Ok] | main.rs:11:23:12:61 | ... .unwrap_or(...) | provenance | MaD:19 | | main.rs:11:23:12:61 | ... .unwrap_or(...) | main.rs:11:9:11:19 | remote_data | provenance | | | main.rs:15:11:15:36 | MacroExpr | main.rs:15:5:15:9 | ...::log | provenance | MaD:1 Sink:MaD:1 | | main.rs:16:11:16:44 | MacroExpr | main.rs:16:5:16:9 | ...::log | provenance | MaD:1 Sink:MaD:1 | @@ -52,12 +53,12 @@ edges | main.rs:22:9:22:21 | formatted_msg | main.rs:23:11:23:29 | MacroExpr | provenance | | | main.rs:22:33:22:63 | ...::format(...) | main.rs:22:33:22:63 | { ... } | provenance | | | main.rs:22:33:22:63 | ...::must_use(...) | main.rs:22:9:22:21 | formatted_msg | provenance | | -| main.rs:22:33:22:63 | MacroExpr | main.rs:22:33:22:63 | ...::format(...) | provenance | MaD:19 | -| main.rs:22:33:22:63 | { ... } | main.rs:22:33:22:63 | ...::must_use(...) | provenance | MaD:20 | +| main.rs:22:33:22:63 | MacroExpr | main.rs:22:33:22:63 | ...::format(...) | provenance | MaD:22 | +| main.rs:22:33:22:63 | { ... } | main.rs:22:33:22:63 | ...::must_use(...) | provenance | MaD:23 | | main.rs:23:11:23:29 | MacroExpr | main.rs:23:5:23:9 | ...::log | provenance | MaD:1 Sink:MaD:1 | | main.rs:26:9:26:18 | concat_msg | main.rs:27:11:27:26 | MacroExpr | provenance | | | main.rs:26:22:26:62 | ... + ... | main.rs:26:9:26:18 | concat_msg | provenance | | -| main.rs:26:54:26:62 | &username [&ref] | main.rs:26:22:26:62 | ... + ... | provenance | MaD:11 | +| main.rs:26:54:26:62 | &username [&ref] | main.rs:26:22:26:62 | ... + ... | provenance | MaD:12 | | main.rs:26:55:26:62 | username | main.rs:26:54:26:62 | &username [&ref] | provenance | | | main.rs:27:11:27:26 | MacroExpr | main.rs:27:5:27:9 | ...::log | provenance | MaD:1 Sink:MaD:1 | | main.rs:30:11:30:66 | MacroExpr | main.rs:30:5:30:9 | ...::log | provenance | MaD:1 Sink:MaD:1 | @@ -66,55 +67,68 @@ edges | main.rs:56:27:56:40 | ...: ... [&ref] | main.rs:65:38:65:45 | username [&ref] | provenance | | | main.rs:65:9:65:17 | user_info [UserInfo] | main.rs:66:28:66:36 | user_info [UserInfo] | provenance | | | main.rs:65:21:65:59 | UserInfo {...} [UserInfo] | main.rs:65:9:65:17 | user_info [UserInfo] | provenance | | -| main.rs:65:38:65:45 | username [&ref] | main.rs:65:38:65:57 | username.to_string() | provenance | MaD:7 | +| main.rs:65:38:65:45 | username [&ref] | main.rs:65:38:65:57 | username.to_string() | provenance | MaD:8 | | main.rs:65:38:65:57 | username.to_string() | main.rs:65:21:65:59 | UserInfo {...} [UserInfo] | provenance | | | main.rs:66:11:66:41 | MacroExpr | main.rs:66:5:66:9 | ...::log | provenance | MaD:1 Sink:MaD:1 | | main.rs:66:28:66:36 | user_info [UserInfo] | main.rs:66:28:66:41 | user_info.name | provenance | | | main.rs:66:28:66:41 | user_info.name | main.rs:66:11:66:41 | MacroExpr | provenance | | -| main.rs:109:13:109:21 | user_data | main.rs:112:15:112:35 | MacroExpr | provenance | | -| main.rs:109:13:109:21 | user_data | main.rs:113:15:113:38 | MacroExpr | provenance | | -| main.rs:109:13:109:21 | user_data | main.rs:114:16:114:37 | MacroExpr | provenance | | -| main.rs:109:13:109:21 | user_data | main.rs:115:16:115:37 | MacroExpr | provenance | | -| main.rs:109:13:109:21 | user_data | main.rs:116:16:116:37 | MacroExpr | provenance | | -| main.rs:109:13:109:21 | user_data | main.rs:119:15:119:75 | MacroExpr | provenance | | -| main.rs:109:25:109:38 | ...::args | main.rs:109:25:109:40 | ...::args(...) [element] | provenance | Src:MaD:5 | -| main.rs:109:25:109:40 | ...::args(...) [element] | main.rs:109:25:109:47 | ... .nth(...) [Some] | provenance | MaD:10 | -| main.rs:109:25:109:47 | ... .nth(...) [Some] | main.rs:109:25:109:67 | ... .unwrap_or_default() | provenance | MaD:14 | -| main.rs:109:25:109:67 | ... .unwrap_or_default() | main.rs:109:13:109:21 | user_data | provenance | | -| main.rs:112:15:112:35 | MacroExpr | main.rs:112:9:112:13 | ...::log | provenance | MaD:1 Sink:MaD:1 | -| main.rs:113:15:113:38 | MacroExpr | main.rs:113:9:113:13 | ...::log | provenance | MaD:1 Sink:MaD:1 | -| main.rs:114:16:114:37 | MacroExpr | main.rs:114:9:114:14 | ...::log | provenance | MaD:1 Sink:MaD:1 | -| main.rs:115:16:115:37 | MacroExpr | main.rs:115:9:115:14 | ...::log | provenance | MaD:1 Sink:MaD:1 | +| main.rs:111:13:111:21 | user_data | main.rs:114:15:114:35 | MacroExpr | provenance | | +| main.rs:111:13:111:21 | user_data | main.rs:115:15:115:38 | MacroExpr | provenance | | +| main.rs:111:13:111:21 | user_data | main.rs:116:16:116:37 | MacroExpr | provenance | | +| main.rs:111:13:111:21 | user_data | main.rs:117:16:117:37 | MacroExpr | provenance | | +| main.rs:111:13:111:21 | user_data | main.rs:118:16:118:37 | MacroExpr | provenance | | +| main.rs:111:13:111:21 | user_data | main.rs:121:15:121:75 | MacroExpr | provenance | | +| main.rs:111:25:111:38 | ...::args | main.rs:111:25:111:40 | ...::args(...) [element] | provenance | Src:MaD:6 | +| main.rs:111:25:111:40 | ...::args(...) [element] | main.rs:111:25:111:47 | ... .nth(...) [Some] | provenance | MaD:11 | +| main.rs:111:25:111:47 | ... .nth(...) [Some] | main.rs:111:25:111:67 | ... .unwrap_or_default() | provenance | MaD:17 | +| main.rs:111:25:111:67 | ... .unwrap_or_default() | main.rs:111:13:111:21 | user_data | provenance | | +| main.rs:114:15:114:35 | MacroExpr | main.rs:114:9:114:13 | ...::log | provenance | MaD:1 Sink:MaD:1 | +| main.rs:115:15:115:38 | MacroExpr | main.rs:115:9:115:13 | ...::log | provenance | MaD:1 Sink:MaD:1 | | main.rs:116:16:116:37 | MacroExpr | main.rs:116:9:116:14 | ...::log | provenance | MaD:1 Sink:MaD:1 | -| main.rs:119:15:119:75 | MacroExpr | main.rs:119:9:119:13 | ...::log | provenance | MaD:1 Sink:MaD:1 | -| main.rs:123:13:123:21 | user_data | main.rs:126:18:126:38 | MacroExpr | provenance | | -| main.rs:123:13:123:21 | user_data | main.rs:127:19:127:49 | MacroExpr | provenance | | -| main.rs:123:25:123:37 | ...::var | main.rs:123:25:123:45 | ...::var(...) [Ok] | provenance | Src:MaD:6 | -| main.rs:123:25:123:45 | ...::var(...) [Ok] | main.rs:123:25:123:65 | ... .unwrap_or_default() | provenance | MaD:17 | -| main.rs:123:25:123:65 | ... .unwrap_or_default() | main.rs:123:13:123:21 | user_data | provenance | | -| main.rs:126:18:126:38 | MacroExpr | main.rs:126:9:126:16 | ...::_print | provenance | MaD:3 Sink:MaD:3 | -| main.rs:127:19:127:49 | MacroExpr | main.rs:127:9:127:17 | ...::_eprint | provenance | MaD:2 Sink:MaD:2 | +| main.rs:117:16:117:37 | MacroExpr | main.rs:117:9:117:14 | ...::log | provenance | MaD:1 Sink:MaD:1 | +| main.rs:118:16:118:37 | MacroExpr | main.rs:118:9:118:14 | ...::log | provenance | MaD:1 Sink:MaD:1 | +| main.rs:121:15:121:75 | MacroExpr | main.rs:121:9:121:13 | ...::log | provenance | MaD:1 Sink:MaD:1 | +| main.rs:129:13:129:21 | user_data | main.rs:132:18:132:38 | MacroExpr | provenance | | +| main.rs:129:13:129:21 | user_data | main.rs:133:19:133:49 | MacroExpr | provenance | | +| main.rs:129:25:129:37 | ...::var | main.rs:129:25:129:45 | ...::var(...) [Ok] | provenance | Src:MaD:7 | +| main.rs:129:25:129:45 | ...::var(...) [Ok] | main.rs:129:25:129:65 | ... .unwrap_or_default() | provenance | MaD:20 | +| main.rs:129:25:129:65 | ... .unwrap_or_default() | main.rs:129:13:129:21 | user_data | provenance | | +| main.rs:132:18:132:38 | MacroExpr | main.rs:132:9:132:16 | ...::_print | provenance | MaD:3 Sink:MaD:3 | +| main.rs:133:19:133:49 | MacroExpr | main.rs:133:9:133:17 | ...::_eprint | provenance | MaD:2 Sink:MaD:2 | +| main.rs:142:32:142:59 | ...: Option::<...> | main.rs:143:22:143:27 | o_path | provenance | | +| main.rs:143:13:143:18 | m_path | main.rs:145:26:145:31 | m_path | provenance | | +| main.rs:143:22:143:27 | o_path | main.rs:143:22:143:38 | o_path.map(...) | provenance | MaD:14 | +| main.rs:143:22:143:27 | o_path | main.rs:143:34:143:34 | ... | provenance | MaD:14 | +| main.rs:143:22:143:38 | o_path.map(...) | main.rs:143:13:143:18 | m_path | provenance | | +| main.rs:143:34:143:34 | ... | main.rs:143:37:143:37 | x | provenance | | +| main.rs:145:18:145:40 | MacroExpr | main.rs:145:9:145:16 | ...::_print | provenance | MaD:3 Sink:MaD:3 | +| main.rs:145:26:145:31 | m_path | main.rs:145:26:145:40 | m_path.unwrap() | provenance | MaD:15 | +| main.rs:145:26:145:40 | m_path.unwrap() | main.rs:145:18:145:40 | MacroExpr | provenance | | +| main.rs:152:28:152:30 | get | main.rs:142:32:142:59 | ...: Option::<...> | provenance | Src:MaD:4 | models | 1 | Sink: log::__private_api::log; Argument[0]; log-injection | | 2 | Sink: std::io::stdio::_eprint; Argument[0]; log-injection | | 3 | Sink: std::io::stdio::_print; Argument[0]; log-injection | -| 4 | Source: reqwest::blocking::get; ReturnValue.Field[core::result::Result::Ok(0)]; remote | -| 5 | Source: std::env::args; ReturnValue.Element; commandargs | -| 6 | Source: std::env::var; ReturnValue.Field[core::result::Result::Ok(0)]; environment | -| 7 | Summary: <_ as alloc::string::ToString>::to_string; Argument[self].Reference; ReturnValue; taint | -| 8 | Summary: <_ as core::clone::Clone>::clone; Argument[self].Reference; ReturnValue; value | -| 9 | Summary: <_ as core::iter::traits::iterator::Iterator>::collect; Argument[self].Element; ReturnValue.Element; value | -| 10 | Summary: <_ as core::iter::traits::iterator::Iterator>::nth; Argument[self].Reference.Element; ReturnValue.Field[core::option::Option::Some(0)]; value | -| 11 | Summary: ::add; Argument[0].Reference; ReturnValue; taint | -| 12 | Summary: ::deref; Argument[self].Reference.Element; ReturnValue.Reference.Element; value | -| 13 | Summary: ::unwrap_or; Argument[self].Field[core::option::Option::Some(0)]; ReturnValue; value | -| 14 | Summary: ::unwrap_or_default; Argument[self].Field[core::option::Option::Some(0)]; ReturnValue; value | -| 15 | Summary: ::unwrap; Argument[self].Field[core::result::Result::Ok(0)]; ReturnValue; value | -| 16 | Summary: ::unwrap_or; Argument[self].Field[core::result::Result::Ok(0)]; ReturnValue; value | -| 17 | Summary: ::unwrap_or_default; Argument[self].Field[core::result::Result::Ok(0)]; ReturnValue; value | -| 18 | Summary: ::text; Argument[self]; ReturnValue.Field[core::result::Result::Ok(0)]; taint | -| 19 | Summary: alloc::fmt::format; Argument[0]; ReturnValue; taint | -| 20 | Summary: core::hint::must_use; Argument[0]; ReturnValue; value | +| 4 | Source: axum::routing::method_routing::get; Argument[0].Parameter[0..7]; remote | +| 5 | Source: reqwest::blocking::get; ReturnValue.Field[core::result::Result::Ok(0)]; remote | +| 6 | Source: std::env::args; ReturnValue.Element; commandargs | +| 7 | Source: std::env::var; ReturnValue.Field[core::result::Result::Ok(0)]; environment | +| 8 | Summary: <_ as alloc::string::ToString>::to_string; Argument[self].Reference; ReturnValue; taint | +| 9 | Summary: <_ as core::clone::Clone>::clone; Argument[self].Reference; ReturnValue; value | +| 10 | Summary: <_ as core::iter::traits::iterator::Iterator>::collect; Argument[self].Element; ReturnValue.Element; value | +| 11 | Summary: <_ as core::iter::traits::iterator::Iterator>::nth; Argument[self].Reference.Element; ReturnValue.Field[core::option::Option::Some(0)]; value | +| 12 | Summary: ::add; Argument[0].Reference; ReturnValue; taint | +| 13 | Summary: ::deref; Argument[self].Reference.Element; ReturnValue.Reference.Element; value | +| 14 | Summary: ::map; Argument[self]; Argument[0].Parameter[0]; taint | +| 15 | Summary: ::unwrap; Argument[self].Field[core::option::Option::Some(0)]; ReturnValue; value | +| 16 | Summary: ::unwrap_or; Argument[self].Field[core::option::Option::Some(0)]; ReturnValue; value | +| 17 | Summary: ::unwrap_or_default; Argument[self].Field[core::option::Option::Some(0)]; ReturnValue; value | +| 18 | Summary: ::unwrap; Argument[self].Field[core::result::Result::Ok(0)]; ReturnValue; value | +| 19 | Summary: ::unwrap_or; Argument[self].Field[core::result::Result::Ok(0)]; ReturnValue; value | +| 20 | Summary: ::unwrap_or_default; Argument[self].Field[core::result::Result::Ok(0)]; ReturnValue; value | +| 21 | Summary: ::text; Argument[self]; ReturnValue.Field[core::result::Result::Ok(0)]; taint | +| 22 | Summary: alloc::fmt::format; Argument[0]; ReturnValue; taint | +| 23 | Summary: core::hint::must_use; Argument[0]; ReturnValue; value | nodes | main.rs:8:9:8:12 | args [element] | semmle.label | args [element] | | main.rs:8:29:8:37 | ...::args | semmle.label | ...::args | @@ -171,29 +185,41 @@ nodes | main.rs:66:11:66:41 | MacroExpr | semmle.label | MacroExpr | | main.rs:66:28:66:36 | user_info [UserInfo] | semmle.label | user_info [UserInfo] | | main.rs:66:28:66:41 | user_info.name | semmle.label | user_info.name | -| main.rs:109:13:109:21 | user_data | semmle.label | user_data | -| main.rs:109:25:109:38 | ...::args | semmle.label | ...::args | -| main.rs:109:25:109:40 | ...::args(...) [element] | semmle.label | ...::args(...) [element] | -| main.rs:109:25:109:47 | ... .nth(...) [Some] | semmle.label | ... .nth(...) [Some] | -| main.rs:109:25:109:67 | ... .unwrap_or_default() | semmle.label | ... .unwrap_or_default() | -| main.rs:112:9:112:13 | ...::log | semmle.label | ...::log | -| main.rs:112:15:112:35 | MacroExpr | semmle.label | MacroExpr | -| main.rs:113:9:113:13 | ...::log | semmle.label | ...::log | -| main.rs:113:15:113:38 | MacroExpr | semmle.label | MacroExpr | -| main.rs:114:9:114:14 | ...::log | semmle.label | ...::log | -| main.rs:114:16:114:37 | MacroExpr | semmle.label | MacroExpr | -| main.rs:115:9:115:14 | ...::log | semmle.label | ...::log | -| main.rs:115:16:115:37 | MacroExpr | semmle.label | MacroExpr | +| main.rs:111:13:111:21 | user_data | semmle.label | user_data | +| main.rs:111:25:111:38 | ...::args | semmle.label | ...::args | +| main.rs:111:25:111:40 | ...::args(...) [element] | semmle.label | ...::args(...) [element] | +| main.rs:111:25:111:47 | ... .nth(...) [Some] | semmle.label | ... .nth(...) [Some] | +| main.rs:111:25:111:67 | ... .unwrap_or_default() | semmle.label | ... .unwrap_or_default() | +| main.rs:114:9:114:13 | ...::log | semmle.label | ...::log | +| main.rs:114:15:114:35 | MacroExpr | semmle.label | MacroExpr | +| main.rs:115:9:115:13 | ...::log | semmle.label | ...::log | +| main.rs:115:15:115:38 | MacroExpr | semmle.label | MacroExpr | | main.rs:116:9:116:14 | ...::log | semmle.label | ...::log | | main.rs:116:16:116:37 | MacroExpr | semmle.label | MacroExpr | -| main.rs:119:9:119:13 | ...::log | semmle.label | ...::log | -| main.rs:119:15:119:75 | MacroExpr | semmle.label | MacroExpr | -| main.rs:123:13:123:21 | user_data | semmle.label | user_data | -| main.rs:123:25:123:37 | ...::var | semmle.label | ...::var | -| main.rs:123:25:123:45 | ...::var(...) [Ok] | semmle.label | ...::var(...) [Ok] | -| main.rs:123:25:123:65 | ... .unwrap_or_default() | semmle.label | ... .unwrap_or_default() | -| main.rs:126:9:126:16 | ...::_print | semmle.label | ...::_print | -| main.rs:126:18:126:38 | MacroExpr | semmle.label | MacroExpr | -| main.rs:127:9:127:17 | ...::_eprint | semmle.label | ...::_eprint | -| main.rs:127:19:127:49 | MacroExpr | semmle.label | MacroExpr | +| main.rs:117:9:117:14 | ...::log | semmle.label | ...::log | +| main.rs:117:16:117:37 | MacroExpr | semmle.label | MacroExpr | +| main.rs:118:9:118:14 | ...::log | semmle.label | ...::log | +| main.rs:118:16:118:37 | MacroExpr | semmle.label | MacroExpr | +| main.rs:121:9:121:13 | ...::log | semmle.label | ...::log | +| main.rs:121:15:121:75 | MacroExpr | semmle.label | MacroExpr | +| main.rs:129:13:129:21 | user_data | semmle.label | user_data | +| main.rs:129:25:129:37 | ...::var | semmle.label | ...::var | +| main.rs:129:25:129:45 | ...::var(...) [Ok] | semmle.label | ...::var(...) [Ok] | +| main.rs:129:25:129:65 | ... .unwrap_or_default() | semmle.label | ... .unwrap_or_default() | +| main.rs:132:9:132:16 | ...::_print | semmle.label | ...::_print | +| main.rs:132:18:132:38 | MacroExpr | semmle.label | MacroExpr | +| main.rs:133:9:133:17 | ...::_eprint | semmle.label | ...::_eprint | +| main.rs:133:19:133:49 | MacroExpr | semmle.label | MacroExpr | +| main.rs:142:32:142:59 | ...: Option::<...> | semmle.label | ...: Option::<...> | +| main.rs:143:13:143:18 | m_path | semmle.label | m_path | +| main.rs:143:22:143:27 | o_path | semmle.label | o_path | +| main.rs:143:22:143:38 | o_path.map(...) | semmle.label | o_path.map(...) | +| main.rs:143:34:143:34 | ... | semmle.label | ... | +| main.rs:143:37:143:37 | x | semmle.label | x | +| main.rs:145:9:145:16 | ...::_print | semmle.label | ...::_print | +| main.rs:145:18:145:40 | MacroExpr | semmle.label | MacroExpr | +| main.rs:145:26:145:31 | m_path | semmle.label | m_path | +| main.rs:145:26:145:40 | m_path.unwrap() | semmle.label | m_path.unwrap() | +| main.rs:152:28:152:30 | get | semmle.label | get | subpaths +| main.rs:143:22:143:27 | o_path | main.rs:143:34:143:34 | ... | main.rs:143:37:143:37 | x | main.rs:143:22:143:38 | o_path.map(...) | diff --git a/rust/ql/test/query-tests/security/CWE-117/main.rs b/rust/ql/test/query-tests/security/CWE-117/main.rs index 9fb3558b3d27..0714cb69b8bc 100644 --- a/rust/ql/test/query-tests/security/CWE-117/main.rs +++ b/rust/ql/test/query-tests/security/CWE-117/main.rs @@ -101,6 +101,8 @@ fn test_indirect_flows(data: &str) { } } +extern crate alloc; + // Additional test patterns for different logging scenarios mod additional_tests { use log::*; @@ -117,6 +119,10 @@ mod additional_tests { // BAD: Complex format strings info!("User {} did action {} at time {}", user_data, "login", "now"); // $ Alert[rust/log-injection]=commandargs + + // GOOD: non-sinks + let _ : Vec = From::from(user_data.clone()); + let _ : Box = From::from(user_data); } pub fn test_println_patterns() { @@ -127,3 +133,22 @@ mod additional_tests { eprintln!("Error for user: {}", user_data); // $ Alert[rust/log-injection]=environment } } + +mod axum_tests { + use axum::extract::{Json, Path, Query, Request}; + use axum::routing::{get, post, put, MethodFilter}; + use axum::Router; + + async fn my_axum_handler_1(o_path: Option>) -> &'static str { + let m_path = o_path.map(|x| x); + + println!("{:?}", m_path.unwrap()); // $ Alert[rust/log-injection]=post_handler + + "" + } + + async fn test_axum() { + let app = Router::<()>::new() + .route("/{a}", get(my_axum_handler_1)); // $ Source=post_handler + } +} diff --git a/rust/ql/test/query-tests/security/CWE-117/options.yml b/rust/ql/test/query-tests/security/CWE-117/options.yml index fae9beded52c..8807ab636318 100644 --- a/rust/ql/test/query-tests/security/CWE-117/options.yml +++ b/rust/ql/test/query-tests/security/CWE-117/options.yml @@ -2,4 +2,5 @@ qltest_cargo_check: true qltest_dependencies: - log = "0.4" - env_logger = "0.10" - - reqwest = { version = "0.12.9", features = ["blocking"] } \ No newline at end of file + - reqwest = { version = "0.12.9", features = ["blocking"] } + - axum = { version = "0.8.7" } diff --git a/rust/ql/test/query-tests/security/CWE-770/UncontrolledAllocationSize.expected b/rust/ql/test/query-tests/security/CWE-770/UncontrolledAllocationSize.expected index 070e05c8ae6b..477dbee0e0f4 100644 --- a/rust/ql/test/query-tests/security/CWE-770/UncontrolledAllocationSize.expected +++ b/rust/ql/test/query-tests/security/CWE-770/UncontrolledAllocationSize.expected @@ -1,56 +1,57 @@ #select -| main.rs:18:13:18:31 | ...::realloc | main.rs:320:13:320:26 | ...::args | main.rs:18:13:18:31 | ...::realloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:21:13:21:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:21:13:21:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:22:13:22:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:22:13:22:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:23:13:23:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:23:13:23:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:24:13:24:36 | ...::alloc_zeroed | main.rs:320:13:320:26 | ...::args | main.rs:24:13:24:36 | ...::alloc_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:30:13:30:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:30:13:30:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:33:13:33:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:33:13:33:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:37:13:37:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:37:13:37:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:40:13:40:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:40:13:40:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:50:13:50:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:50:13:50:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:51:13:51:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:51:13:51:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:53:13:53:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:53:13:53:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:54:13:54:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:54:13:54:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:59:13:59:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:59:13:59:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:61:13:61:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:61:13:61:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:63:13:63:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:63:13:63:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:64:13:64:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:64:13:64:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:65:13:65:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:65:13:65:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:68:13:68:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:68:13:68:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:88:13:88:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:88:13:88:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:96:17:96:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:96:17:96:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:102:17:102:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:102:17:102:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:103:17:103:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:103:17:103:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:109:17:109:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:109:17:109:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:111:17:111:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:111:17:111:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:146:17:146:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:146:17:146:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:148:17:148:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:148:17:148:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:152:13:152:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:152:13:152:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:155:13:155:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:155:13:155:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:162:17:162:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:162:17:162:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:169:17:169:33 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:169:17:169:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:177:13:177:29 | ...::alloc | main.rs:320:13:320:26 | ...::args | main.rs:177:13:177:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:193:32:193:36 | alloc | main.rs:320:13:320:26 | ...::args | main.rs:193:32:193:36 | alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:194:32:194:43 | alloc_zeroed | main.rs:320:13:320:26 | ...::args | main.rs:194:32:194:43 | alloc_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:195:32:195:39 | allocate | main.rs:320:13:320:26 | ...::args | main.rs:195:32:195:39 | allocate | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:196:32:196:46 | allocate_zeroed | main.rs:320:13:320:26 | ...::args | main.rs:196:32:196:46 | allocate_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:197:32:197:39 | allocate | main.rs:320:13:320:26 | ...::args | main.rs:197:32:197:39 | allocate | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:198:32:198:46 | allocate_zeroed | main.rs:320:13:320:26 | ...::args | main.rs:198:32:198:46 | allocate_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:202:32:202:38 | realloc | main.rs:320:13:320:26 | ...::args | main.rs:202:32:202:38 | realloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:208:40:208:43 | grow | main.rs:320:13:320:26 | ...::args | main.rs:208:40:208:43 | grow | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:210:40:210:50 | grow_zeroed | main.rs:320:13:320:26 | ...::args | main.rs:210:40:210:50 | grow_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:213:36:213:41 | shrink | main.rs:320:13:320:26 | ...::args | main.rs:213:36:213:41 | shrink | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:219:13:219:24 | ...::malloc | main.rs:320:13:320:26 | ...::args | main.rs:219:13:219:24 | ...::malloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:220:13:220:31 | ...::aligned_alloc | main.rs:320:13:320:26 | ...::args | main.rs:220:13:220:31 | ...::aligned_alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:222:13:222:24 | ...::calloc | main.rs:320:13:320:26 | ...::args | main.rs:222:13:222:24 | ...::calloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:223:13:223:24 | ...::calloc | main.rs:320:13:320:26 | ...::args | main.rs:223:13:223:24 | ...::calloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:224:13:224:25 | ...::realloc | main.rs:320:13:320:26 | ...::args | main.rs:224:13:224:25 | ...::realloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:228:13:228:41 | ...::try_with_capacity | main.rs:320:13:320:26 | ...::args | main.rs:228:13:228:41 | ...::try_with_capacity | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:229:13:229:37 | ...::with_capacity | main.rs:320:13:320:26 | ...::args | main.rs:229:13:229:37 | ...::with_capacity | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:230:13:230:44 | ...::try_with_capacity_in | main.rs:320:13:320:26 | ...::args | main.rs:230:13:230:44 | ...::try_with_capacity_in | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | -| main.rs:231:13:231:40 | ...::with_capacity_in | main.rs:320:13:320:26 | ...::args | main.rs:231:13:231:40 | ...::with_capacity_in | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:320:13:320:26 | ...::args | user-provided value | +| main.rs:18:13:18:31 | ...::realloc | main.rs:339:13:339:26 | ...::args | main.rs:18:13:18:31 | ...::realloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:21:13:21:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:21:13:21:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:22:13:22:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:22:13:22:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:23:13:23:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:23:13:23:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:24:13:24:36 | ...::alloc_zeroed | main.rs:339:13:339:26 | ...::args | main.rs:24:13:24:36 | ...::alloc_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:30:13:30:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:30:13:30:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:33:13:33:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:33:13:33:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:37:13:37:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:37:13:37:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:40:13:40:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:40:13:40:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:50:13:50:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:50:13:50:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:51:13:51:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:51:13:51:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:53:13:53:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:53:13:53:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:54:13:54:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:54:13:54:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:59:13:59:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:59:13:59:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:61:13:61:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:61:13:61:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:63:13:63:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:63:13:63:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:64:13:64:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:64:13:64:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:65:13:65:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:65:13:65:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:68:13:68:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:68:13:68:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:88:13:88:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:88:13:88:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:96:17:96:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:96:17:96:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:102:17:102:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:102:17:102:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:103:17:103:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:103:17:103:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:109:17:109:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:109:17:109:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:111:17:111:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:111:17:111:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:146:17:146:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:146:17:146:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:148:17:148:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:148:17:148:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:152:13:152:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:152:13:152:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:155:13:155:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:155:13:155:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:162:17:162:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:162:17:162:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:169:17:169:33 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:169:17:169:33 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:177:13:177:29 | ...::alloc | main.rs:339:13:339:26 | ...::args | main.rs:177:13:177:29 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:193:32:193:36 | alloc | main.rs:339:13:339:26 | ...::args | main.rs:193:32:193:36 | alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:194:32:194:43 | alloc_zeroed | main.rs:339:13:339:26 | ...::args | main.rs:194:32:194:43 | alloc_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:195:32:195:39 | allocate | main.rs:339:13:339:26 | ...::args | main.rs:195:32:195:39 | allocate | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:196:32:196:46 | allocate_zeroed | main.rs:339:13:339:26 | ...::args | main.rs:196:32:196:46 | allocate_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:197:32:197:39 | allocate | main.rs:339:13:339:26 | ...::args | main.rs:197:32:197:39 | allocate | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:198:32:198:46 | allocate_zeroed | main.rs:339:13:339:26 | ...::args | main.rs:198:32:198:46 | allocate_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:202:32:202:38 | realloc | main.rs:339:13:339:26 | ...::args | main.rs:202:32:202:38 | realloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:208:40:208:43 | grow | main.rs:339:13:339:26 | ...::args | main.rs:208:40:208:43 | grow | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:210:40:210:50 | grow_zeroed | main.rs:339:13:339:26 | ...::args | main.rs:210:40:210:50 | grow_zeroed | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:213:36:213:41 | shrink | main.rs:339:13:339:26 | ...::args | main.rs:213:36:213:41 | shrink | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:219:13:219:24 | ...::malloc | main.rs:339:13:339:26 | ...::args | main.rs:219:13:219:24 | ...::malloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:220:13:220:31 | ...::aligned_alloc | main.rs:339:13:339:26 | ...::args | main.rs:220:13:220:31 | ...::aligned_alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:222:13:222:24 | ...::calloc | main.rs:339:13:339:26 | ...::args | main.rs:222:13:222:24 | ...::calloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:223:13:223:24 | ...::calloc | main.rs:339:13:339:26 | ...::args | main.rs:223:13:223:24 | ...::calloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:224:13:224:25 | ...::realloc | main.rs:339:13:339:26 | ...::args | main.rs:224:13:224:25 | ...::realloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:228:13:228:41 | ...::try_with_capacity | main.rs:339:13:339:26 | ...::args | main.rs:228:13:228:41 | ...::try_with_capacity | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:229:13:229:37 | ...::with_capacity | main.rs:339:13:339:26 | ...::args | main.rs:229:13:229:37 | ...::with_capacity | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:230:13:230:44 | ...::try_with_capacity_in | main.rs:339:13:339:26 | ...::args | main.rs:230:13:230:44 | ...::try_with_capacity_in | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | +| main.rs:231:13:231:40 | ...::with_capacity_in | main.rs:339:13:339:26 | ...::args | main.rs:231:13:231:40 | ...::with_capacity_in | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | | main.rs:287:22:287:38 | ...::alloc | main.rs:311:25:311:38 | ...::args | main.rs:287:22:287:38 | ...::alloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:311:25:311:38 | ...::args | user-provided value | +| main.rs:331:13:331:24 | ...::malloc | main.rs:339:13:339:26 | ...::args | main.rs:331:13:331:24 | ...::malloc | This allocation size is derived from a $@ and could allocate arbitrary amounts of memory. | main.rs:339:13:339:26 | ...::args | user-provided value | edges | main.rs:12:36:12:43 | ...: usize | main.rs:18:41:18:41 | v | provenance | | | main.rs:18:41:18:41 | v | main.rs:18:13:18:31 | ...::realloc | provenance | MaD:17 Sink:MaD:17 | @@ -270,24 +271,28 @@ edges | main.rs:311:25:311:40 | ...::args(...) [element] | main.rs:311:25:311:47 | ... .nth(...) [Some] | provenance | MaD:23 | | main.rs:311:25:311:47 | ... .nth(...) [Some] | main.rs:311:25:311:74 | ... .unwrap_or(...) | provenance | MaD:39 | | main.rs:311:25:311:74 | ... .unwrap_or(...) | main.rs:282:24:282:41 | ...: String | provenance | | -| main.rs:320:9:320:9 | v | main.rs:323:34:323:34 | v | provenance | | -| main.rs:320:9:320:9 | v | main.rs:324:42:324:42 | v | provenance | | -| main.rs:320:9:320:9 | v | main.rs:325:36:325:36 | v | provenance | | -| main.rs:320:9:320:9 | v | main.rs:326:27:326:27 | v | provenance | | -| main.rs:320:9:320:9 | v | main.rs:327:25:327:25 | v | provenance | | -| main.rs:320:9:320:9 | v | main.rs:328:22:328:22 | v | provenance | | -| main.rs:320:13:320:26 | ...::args | main.rs:320:13:320:28 | ...::args(...) [element] | provenance | Src:MaD:22 | -| main.rs:320:13:320:28 | ...::args(...) [element] | main.rs:320:13:320:35 | ... .nth(...) [Some] | provenance | MaD:23 | -| main.rs:320:13:320:35 | ... .nth(...) [Some] | main.rs:320:13:320:65 | ... .unwrap_or(...) | provenance | MaD:39 | -| main.rs:320:13:320:65 | ... .unwrap_or(...) | main.rs:320:13:320:82 | ... .parse() [Ok] | provenance | MaD:26 | -| main.rs:320:13:320:82 | ... .parse() [Ok] | main.rs:320:13:320:91 | ... .unwrap() | provenance | MaD:41 | -| main.rs:320:13:320:91 | ... .unwrap() | main.rs:320:9:320:9 | v | provenance | | -| main.rs:323:34:323:34 | v | main.rs:12:36:12:43 | ...: usize | provenance | | -| main.rs:324:42:324:42 | v | main.rs:43:44:43:51 | ...: usize | provenance | | -| main.rs:325:36:325:36 | v | main.rs:91:38:91:45 | ...: usize | provenance | | -| main.rs:326:27:326:27 | v | main.rs:183:29:183:36 | ...: usize | provenance | | -| main.rs:327:25:327:25 | v | main.rs:217:27:217:34 | ...: usize | provenance | | -| main.rs:328:22:328:22 | v | main.rs:227:24:227:31 | ...: usize | provenance | | +| main.rs:317:26:317:33 | ...: usize | main.rs:331:26:331:26 | a | provenance | | +| main.rs:331:26:331:26 | a | main.rs:331:13:331:24 | ...::malloc | provenance | MaD:20 Sink:MaD:20 | +| main.rs:339:9:339:9 | v | main.rs:342:34:342:34 | v | provenance | | +| main.rs:339:9:339:9 | v | main.rs:343:42:343:42 | v | provenance | | +| main.rs:339:9:339:9 | v | main.rs:344:36:344:36 | v | provenance | | +| main.rs:339:9:339:9 | v | main.rs:345:27:345:27 | v | provenance | | +| main.rs:339:9:339:9 | v | main.rs:346:25:346:25 | v | provenance | | +| main.rs:339:9:339:9 | v | main.rs:347:22:347:22 | v | provenance | | +| main.rs:339:9:339:9 | v | main.rs:349:24:349:24 | v | provenance | | +| main.rs:339:13:339:26 | ...::args | main.rs:339:13:339:28 | ...::args(...) [element] | provenance | Src:MaD:22 | +| main.rs:339:13:339:28 | ...::args(...) [element] | main.rs:339:13:339:35 | ... .nth(...) [Some] | provenance | MaD:23 | +| main.rs:339:13:339:35 | ... .nth(...) [Some] | main.rs:339:13:339:65 | ... .unwrap_or(...) | provenance | MaD:39 | +| main.rs:339:13:339:65 | ... .unwrap_or(...) | main.rs:339:13:339:82 | ... .parse() [Ok] | provenance | MaD:26 | +| main.rs:339:13:339:82 | ... .parse() [Ok] | main.rs:339:13:339:91 | ... .unwrap() | provenance | MaD:41 | +| main.rs:339:13:339:91 | ... .unwrap() | main.rs:339:9:339:9 | v | provenance | | +| main.rs:342:34:342:34 | v | main.rs:12:36:12:43 | ...: usize | provenance | | +| main.rs:343:42:343:42 | v | main.rs:43:44:43:51 | ...: usize | provenance | | +| main.rs:344:36:344:36 | v | main.rs:91:38:91:45 | ...: usize | provenance | | +| main.rs:345:27:345:27 | v | main.rs:183:29:183:36 | ...: usize | provenance | | +| main.rs:346:25:346:25 | v | main.rs:217:27:217:34 | ...: usize | provenance | | +| main.rs:347:22:347:22 | v | main.rs:227:24:227:31 | ...: usize | provenance | | +| main.rs:349:24:349:24 | v | main.rs:317:26:317:33 | ...: usize | provenance | | models | 1 | Sink: ::allocate; Argument[0]; alloc-layout | | 2 | Sink: ::allocate_zeroed; Argument[0]; alloc-layout | @@ -555,17 +560,21 @@ nodes | main.rs:311:25:311:40 | ...::args(...) [element] | semmle.label | ...::args(...) [element] | | main.rs:311:25:311:47 | ... .nth(...) [Some] | semmle.label | ... .nth(...) [Some] | | main.rs:311:25:311:74 | ... .unwrap_or(...) | semmle.label | ... .unwrap_or(...) | -| main.rs:320:9:320:9 | v | semmle.label | v | -| main.rs:320:13:320:26 | ...::args | semmle.label | ...::args | -| main.rs:320:13:320:28 | ...::args(...) [element] | semmle.label | ...::args(...) [element] | -| main.rs:320:13:320:35 | ... .nth(...) [Some] | semmle.label | ... .nth(...) [Some] | -| main.rs:320:13:320:65 | ... .unwrap_or(...) | semmle.label | ... .unwrap_or(...) | -| main.rs:320:13:320:82 | ... .parse() [Ok] | semmle.label | ... .parse() [Ok] | -| main.rs:320:13:320:91 | ... .unwrap() | semmle.label | ... .unwrap() | -| main.rs:323:34:323:34 | v | semmle.label | v | -| main.rs:324:42:324:42 | v | semmle.label | v | -| main.rs:325:36:325:36 | v | semmle.label | v | -| main.rs:326:27:326:27 | v | semmle.label | v | -| main.rs:327:25:327:25 | v | semmle.label | v | -| main.rs:328:22:328:22 | v | semmle.label | v | +| main.rs:317:26:317:33 | ...: usize | semmle.label | ...: usize | +| main.rs:331:13:331:24 | ...::malloc | semmle.label | ...::malloc | +| main.rs:331:26:331:26 | a | semmle.label | a | +| main.rs:339:9:339:9 | v | semmle.label | v | +| main.rs:339:13:339:26 | ...::args | semmle.label | ...::args | +| main.rs:339:13:339:28 | ...::args(...) [element] | semmle.label | ...::args(...) [element] | +| main.rs:339:13:339:35 | ... .nth(...) [Some] | semmle.label | ... .nth(...) [Some] | +| main.rs:339:13:339:65 | ... .unwrap_or(...) | semmle.label | ... .unwrap_or(...) | +| main.rs:339:13:339:82 | ... .parse() [Ok] | semmle.label | ... .parse() [Ok] | +| main.rs:339:13:339:91 | ... .unwrap() | semmle.label | ... .unwrap() | +| main.rs:342:34:342:34 | v | semmle.label | v | +| main.rs:343:42:343:42 | v | semmle.label | v | +| main.rs:344:36:344:36 | v | semmle.label | v | +| main.rs:345:27:345:27 | v | semmle.label | v | +| main.rs:346:25:346:25 | v | semmle.label | v | +| main.rs:347:22:347:22 | v | semmle.label | v | +| main.rs:349:24:349:24 | v | semmle.label | v | subpaths diff --git a/rust/ql/test/query-tests/security/CWE-770/main.rs b/rust/ql/test/query-tests/security/CWE-770/main.rs index 916bc55ad7d1..7ab9f9445fba 100644 --- a/rust/ql/test/query-tests/security/CWE-770/main.rs +++ b/rust/ql/test/query-tests/security/CWE-770/main.rs @@ -312,6 +312,25 @@ fn test_examples() { allocate_buffer_good(std::env::args().nth(1).unwrap_or("0".to_string())); } +extern crate alloc; + +unsafe fn test_non_sinks(a: usize) { + let b = a as u64; + + let _ = Vec::from([a]); + let _ = std::vec::Vec::from([a]); + let _ = alloc::vec::Vec::from([a]); + + let _ : Vec = From::from([a]); + let _ : std::vec::Vec = From::from([a]); + let _ : alloc::vec::Vec = From::from([a]); + + let _ = i128 ::from(b); + let _ : i128 = From::from(b); + + let _ = libc::malloc(a); // $ Alert[rust/uncontrolled-allocation-size]=arg1 +} + // --- main --- fn main() { @@ -327,6 +346,7 @@ fn main() { test_libc_alloc(v); test_vectors(v); test_examples(); + test_non_sinks(v); } println!("--- end ---");