Rust: Update expected test output

This commit is contained in:
Tom Hvitved
2025-07-09 11:31:56 +02:00
parent ebde0bdc47
commit c7d20eb98a
15 changed files with 56 additions and 95 deletions

View File

@@ -1,19 +1,10 @@
multipleCallTargets
| proc_macro.rs:6:18:6:61 | ...::from(...) |
| proc_macro.rs:7:15:7:58 | ...::from(...) |
| proc_macro.rs:15:5:17:5 | ...::new(...) |
| proc_macro.rs:16:12:16:16 | ...::to_tokens(...) |
| proc_macro.rs:22:15:22:58 | ...::from(...) |
| proc_macro.rs:25:5:28:5 | ...::new(...) |
| proc_macro.rs:26:10:26:12 | ...::to_tokens(...) |
| proc_macro.rs:27:10:27:16 | ...::to_tokens(...) |
| proc_macro.rs:38:15:38:64 | ...::from(...) |
| proc_macro.rs:41:5:49:5 | ...::new(...) |
| proc_macro.rs:41:5:49:5 | ...::new(...) |
| proc_macro.rs:41:5:49:5 | ...::new(...) |
| proc_macro.rs:41:5:49:5 | ...::new(...) |
| proc_macro.rs:42:16:42:26 | ...::to_tokens(...) |
| proc_macro.rs:44:27:44:30 | ...::to_tokens(...) |
| proc_macro.rs:46:18:46:28 | ...::to_tokens(...) |
multiplePathResolutions
| macro_expansion.rs:1:5:1:14 | proc_macro |

View File

@@ -117,6 +117,11 @@ edges
| main.rs:228:11:228:14 | [post] self [&ref, MyInt] | main.rs:227:19:227:27 | SelfParam [Return] [&ref, MyInt] | provenance | |
| main.rs:228:25:228:27 | rhs [MyInt] | main.rs:228:25:228:33 | rhs.value | provenance | |
| main.rs:228:25:228:33 | rhs.value | main.rs:228:10:228:14 | [post] * ... [MyInt] | provenance | |
| main.rs:235:14:235:18 | SelfParam [&ref, MyInt] | main.rs:236:12:236:15 | self [&ref, MyInt] | provenance | |
| main.rs:236:9:236:22 | &... [&ref] | main.rs:235:38:237:5 | { ... } [&ref] | provenance | |
| main.rs:236:10:236:22 | ... .value | main.rs:236:9:236:22 | &... [&ref] | provenance | |
| main.rs:236:11:236:15 | * ... [MyInt] | main.rs:236:10:236:22 | ... .value | provenance | |
| main.rs:236:12:236:15 | self [&ref, MyInt] | main.rs:236:11:236:15 | * ... [MyInt] | provenance | |
| main.rs:242:9:242:9 | a [MyInt] | main.rs:244:13:244:13 | a [MyInt] | provenance | |
| main.rs:242:13:242:38 | MyInt {...} [MyInt] | main.rs:242:9:242:9 | a [MyInt] | provenance | |
| main.rs:242:28:242:36 | source(...) | main.rs:242:13:242:38 | MyInt {...} [MyInt] | provenance | |
@@ -140,6 +145,15 @@ edges
| main.rs:261:35:261:35 | b [MyInt] | main.rs:227:30:227:39 | ...: MyInt [MyInt] | provenance | |
| main.rs:261:35:261:35 | b [MyInt] | main.rs:261:27:261:32 | [post] &mut a [&ref, MyInt] | provenance | |
| main.rs:262:10:262:10 | a [MyInt] | main.rs:262:10:262:16 | a.value | provenance | |
| main.rs:270:9:270:9 | a [MyInt] | main.rs:272:28:272:28 | a [MyInt] | provenance | |
| main.rs:270:13:270:39 | MyInt {...} [MyInt] | main.rs:270:9:270:9 | a [MyInt] | provenance | |
| main.rs:270:28:270:37 | source(...) | main.rs:270:13:270:39 | MyInt {...} [MyInt] | provenance | |
| main.rs:272:9:272:9 | c | main.rs:273:10:273:10 | c | provenance | |
| main.rs:272:13:272:29 | * ... | main.rs:272:9:272:9 | c | provenance | |
| main.rs:272:14:272:29 | ...::deref(...) [&ref] | main.rs:272:13:272:29 | * ... | provenance | |
| main.rs:272:27:272:28 | &a [&ref, MyInt] | main.rs:235:14:235:18 | SelfParam [&ref, MyInt] | provenance | |
| main.rs:272:27:272:28 | &a [&ref, MyInt] | main.rs:272:14:272:29 | ...::deref(...) [&ref] | provenance | |
| main.rs:272:28:272:28 | a [MyInt] | main.rs:272:27:272:28 | &a [&ref, MyInt] | provenance | |
| main.rs:289:18:289:21 | SelfParam [MyInt] | main.rs:289:48:291:5 | { ... } [MyInt] | provenance | |
| main.rs:293:26:293:37 | ...: MyInt [MyInt] | main.rs:293:49:295:5 | { ... } [MyInt] | provenance | |
| main.rs:299:9:299:9 | a [MyInt] | main.rs:301:50:301:50 | a [MyInt] | provenance | |
@@ -297,6 +311,12 @@ nodes
| main.rs:228:11:228:14 | [post] self [&ref, MyInt] | semmle.label | [post] self [&ref, MyInt] |
| main.rs:228:25:228:27 | rhs [MyInt] | semmle.label | rhs [MyInt] |
| main.rs:228:25:228:33 | rhs.value | semmle.label | rhs.value |
| main.rs:235:14:235:18 | SelfParam [&ref, MyInt] | semmle.label | SelfParam [&ref, MyInt] |
| main.rs:235:38:237:5 | { ... } [&ref] | semmle.label | { ... } [&ref] |
| main.rs:236:9:236:22 | &... [&ref] | semmle.label | &... [&ref] |
| main.rs:236:10:236:22 | ... .value | semmle.label | ... .value |
| main.rs:236:11:236:15 | * ... [MyInt] | semmle.label | * ... [MyInt] |
| main.rs:236:12:236:15 | self [&ref, MyInt] | semmle.label | self [&ref, MyInt] |
| main.rs:242:9:242:9 | a [MyInt] | semmle.label | a [MyInt] |
| main.rs:242:13:242:38 | MyInt {...} [MyInt] | semmle.label | MyInt {...} [MyInt] |
| main.rs:242:28:242:36 | source(...) | semmle.label | source(...) |
@@ -320,6 +340,15 @@ nodes
| main.rs:261:35:261:35 | b [MyInt] | semmle.label | b [MyInt] |
| main.rs:262:10:262:10 | a [MyInt] | semmle.label | a [MyInt] |
| main.rs:262:10:262:16 | a.value | semmle.label | a.value |
| main.rs:270:9:270:9 | a [MyInt] | semmle.label | a [MyInt] |
| main.rs:270:13:270:39 | MyInt {...} [MyInt] | semmle.label | MyInt {...} [MyInt] |
| main.rs:270:28:270:37 | source(...) | semmle.label | source(...) |
| main.rs:272:9:272:9 | c | semmle.label | c |
| main.rs:272:13:272:29 | * ... | semmle.label | * ... |
| main.rs:272:14:272:29 | ...::deref(...) [&ref] | semmle.label | ...::deref(...) [&ref] |
| main.rs:272:27:272:28 | &a [&ref, MyInt] | semmle.label | &a [&ref, MyInt] |
| main.rs:272:28:272:28 | a [MyInt] | semmle.label | a [MyInt] |
| main.rs:273:10:273:10 | c | semmle.label | c |
| main.rs:289:18:289:21 | SelfParam [MyInt] | semmle.label | SelfParam [MyInt] |
| main.rs:289:48:291:5 | { ... } [MyInt] | semmle.label | { ... } [MyInt] |
| main.rs:293:26:293:37 | ...: MyInt [MyInt] | semmle.label | ...: MyInt [MyInt] |
@@ -367,6 +396,7 @@ subpaths
| main.rs:244:13:244:13 | a [MyInt] | main.rs:220:12:220:15 | SelfParam [MyInt] | main.rs:220:42:223:5 | { ... } [MyInt] | main.rs:244:13:244:17 | ... + ... [MyInt] |
| main.rs:252:9:252:9 | a [MyInt] | main.rs:220:12:220:15 | SelfParam [MyInt] | main.rs:220:42:223:5 | { ... } [MyInt] | main.rs:254:13:254:20 | a.add(...) [MyInt] |
| main.rs:261:35:261:35 | b [MyInt] | main.rs:227:30:227:39 | ...: MyInt [MyInt] | main.rs:227:19:227:27 | SelfParam [Return] [&ref, MyInt] | main.rs:261:27:261:32 | [post] &mut a [&ref, MyInt] |
| main.rs:272:27:272:28 | &a [&ref, MyInt] | main.rs:235:14:235:18 | SelfParam [&ref, MyInt] | main.rs:235:38:237:5 | { ... } [&ref] | main.rs:272:14:272:29 | ...::deref(...) [&ref] |
| main.rs:301:50:301:50 | a [MyInt] | main.rs:289:18:289:21 | SelfParam [MyInt] | main.rs:289:48:291:5 | { ... } [MyInt] | main.rs:301:30:301:54 | ...::take_self(...) [MyInt] |
| main.rs:306:55:306:55 | b [MyInt] | main.rs:293:26:293:37 | ...: MyInt [MyInt] | main.rs:293:49:295:5 | { ... } [MyInt] | main.rs:306:30:306:56 | ...::take_second(...) [MyInt] |
testFailures
@@ -393,6 +423,7 @@ testFailures
| main.rs:245:10:245:16 | c.value | main.rs:242:28:242:36 | source(...) | main.rs:245:10:245:16 | c.value | $@ | main.rs:242:28:242:36 | source(...) | source(...) |
| main.rs:255:10:255:16 | d.value | main.rs:252:28:252:36 | source(...) | main.rs:255:10:255:16 | d.value | $@ | main.rs:252:28:252:36 | source(...) | source(...) |
| main.rs:262:10:262:16 | a.value | main.rs:259:28:259:37 | source(...) | main.rs:262:10:262:16 | a.value | $@ | main.rs:259:28:259:37 | source(...) | source(...) |
| main.rs:273:10:273:10 | c | main.rs:270:28:270:37 | source(...) | main.rs:273:10:273:10 | c | $@ | main.rs:270:28:270:37 | source(...) | source(...) |
| main.rs:302:10:302:10 | c | main.rs:299:28:299:36 | source(...) | main.rs:302:10:302:10 | c | $@ | main.rs:299:28:299:36 | source(...) | source(...) |
| main.rs:307:10:307:10 | c | main.rs:305:28:305:37 | source(...) | main.rs:307:10:307:10 | c | $@ | main.rs:305:28:305:37 | source(...) | source(...) |
| main.rs:317:10:317:10 | a | main.rs:316:13:316:21 | source(...) | main.rs:317:10:317:10 | a | $@ | main.rs:316:13:316:21 | source(...) | source(...) |

View File

@@ -270,7 +270,7 @@ fn test_operator_overloading() {
let a = MyInt { value: source(27) };
// The line below is what the prefix `*` desugars to.
let c = *Deref::deref(&a);
sink(c); // $ MISSING: hasValueFlow=27
sink(c); // $ hasValueFlow=27
let a = MyInt { value: source(28) };
let c = *a;

View File

@@ -77,6 +77,7 @@
| main.rs:266:5:266:10 | ... *= ... | main.rs:227:5:229:5 | fn mul_assign |
| main.rs:267:5:267:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:270:28:270:37 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:272:14:272:29 | ...::deref(...) | main.rs:235:5:237:5 | fn deref |
| main.rs:273:5:273:11 | sink(...) | main.rs:5:1:7:1 | fn sink |
| main.rs:275:28:275:37 | source(...) | main.rs:1:1:3:1 | fn source |
| main.rs:276:13:276:14 | * ... | main.rs:235:5:237:5 | fn deref |

View File

@@ -1,3 +0,0 @@
multipleCallTargets
| main.rs:532:10:532:21 | ...::from(...) |
| main.rs:538:10:538:21 | ...::from(...) |

View File

@@ -529,7 +529,7 @@ fn conversions() {
sink(a as i64); // $ hasTaintFlow=50
sink(a.into()); // $ MISSING: hasValueFlow=50
sink(i64::from(a)); // $ hasTaintFlow=50
sink(i64::from(a)); // $ MISSING: hasTaintFlow=50 -- we cannot resolve the `impl<T> From<T> for T` implementation
let b: i32 = source(51) as i32;

View File

@@ -32,7 +32,6 @@ multipleCallTargets
| test.rs:737:30:737:43 | ...::_print(...) |
| test.rs:752:14:752:43 | ...::_print(...) |
| test.rs:766:14:766:34 | ...::_print(...) |
| test.rs:777:23:777:80 | ...::try_from(...) |
| test.rs:806:50:806:66 | ...::from(...) |
| test.rs:806:50:806:66 | ...::from(...) |
| test.rs:808:14:808:31 | ...::_print(...) |
@@ -74,14 +73,11 @@ multipleCallTargets
| test.rs:883:14:883:29 | ...::_print(...) |
| test.rs:885:27:885:36 | ...::_print(...) |
| test.rs:886:28:886:41 | ...::_print(...) |
| test_futures_io.rs:25:23:25:80 | ...::try_from(...) |
| test_futures_io.rs:35:26:35:63 | pinned.poll_read(...) |
| test_futures_io.rs:62:22:62:50 | pinned.poll_fill_buf(...) |
| test_futures_io.rs:69:23:69:67 | ... .poll_fill_buf(...) |
| test_futures_io.rs:93:26:93:63 | pinned.poll_read(...) |
| test_futures_io.rs:116:22:116:50 | pinned.poll_fill_buf(...) |
| test_futures_io.rs:145:26:145:49 | ...::with_capacity(...) |
| web_frameworks.rs:40:5:40:26 | ...::write_str(...) |
| web_frameworks.rs:40:5:40:26 | ...::write_str(...) |
| web_frameworks.rs:101:14:101:23 | a.as_str() |
| web_frameworks.rs:102:14:102:25 | a.as_bytes() |

View File

@@ -42,8 +42,8 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
{
// using the `AsyncReadExt::read` extension method (higher-level)
let mut buffer1 = [0u8; 64];
let bytes_read1 = futures::io::AsyncReadExt::read(&mut reader, &mut buffer1).await?;
sink(&buffer1[..bytes_read1]); // $ hasTaintFlow=url
let bytes_read1 = futures::io::AsyncReadExt::read(&mut reader, &mut buffer1).await?; // we cannot resolve the `read` call, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
sink(&buffer1[..bytes_read1]); // $ MISSING: hasTaintFlow=url
let mut buffer2 = [0u8; 64];
let bytes_read2 = reader.read(&mut buffer2).await?; // we cannot resolve the `read` call, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
@@ -100,8 +100,8 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
{
// using the `AsyncReadExt::read` extension method (higher-level)
let mut buffer1 = [0u8; 64];
let bytes_read1 = futures::io::AsyncReadExt::read(&mut reader2, &mut buffer1).await?;
sink(&buffer1[..bytes_read1]); // $ hasTaintFlow=url
let bytes_read1 = futures::io::AsyncReadExt::read(&mut reader2, &mut buffer1).await?; // we cannot resolve the `read` call, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
sink(&buffer1[..bytes_read1]); // $ MISSING: hasTaintFlow=url
let mut buffer2 = [0u8; 64];
let bytes_read2 = reader2.read(&mut buffer2).await?; // we cannot resolve the `read` call, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`

View File

@@ -1,9 +1,6 @@
multipleCallTargets
| main.rs:118:9:118:11 | f(...) |
| proc_macro.rs:6:16:6:59 | ...::from(...) |
| proc_macro.rs:7:19:7:62 | ...::from(...) |
| proc_macro.rs:9:5:11:5 | ...::new(...) |
| proc_macro.rs:10:10:10:12 | ...::to_tokens(...) |
multiplePathResolutions
| main.rs:626:3:626:12 | proc_macro |
| main.rs:632:7:632:16 | proc_macro |

View File

@@ -1,13 +1,8 @@
multipleCallTargets
| dereference.rs:61:15:61:24 | e1.deref() |
| main.rs:2129:17:2129:35 | ...::my_from(...) |
| main.rs:2130:17:2130:34 | ...::my_from(...) |
| main.rs:2132:9:2132:34 | ...::my_from2(...) |
| main.rs:2133:9:2133:33 | ...::my_from2(...) |
| main.rs:2186:13:2186:31 | ...::from(...) |
| main.rs:2187:13:2187:31 | ...::from(...) |
| main.rs:2188:13:2188:31 | ...::from(...) |
| main.rs:2194:13:2194:31 | ...::from(...) |
| main.rs:2195:13:2195:31 | ...::from(...) |
| main.rs:2196:13:2196:31 | ...::from(...) |
| main.rs:2232:21:2232:43 | ...::from(...) |

View File

@@ -2126,21 +2126,21 @@ mod method_determined_by_argument_type {
S(1i64).my_add(3i64); // $ MISSING: method=S::my_add2
S(1i64).my_add(&3i64); // $ method=S::my_add3
let x = i64::my_from(73i64); // $ method=MyFrom<i64>::my_from $ SPURIOUS: method=MyFrom<bool>::my_from
let y = i64::my_from(true); // $ method=MyFrom<bool>::my_from $ SPURIOUS: method=MyFrom<i64>::my_from
let z: i64 = MyFrom::my_from(73i64); // $ MISSING: method=MyFrom<i64>::my_from $ SPURIOUS: method=MyFrom::my_from
i64::my_from2(73i64, 0i64); // $ method=MyFrom2<i64>::my_from2 $ SPURIOUS: method=MyFrom2<bool>::my_from2
i64::my_from2(true, 0i64); // $ method=MyFrom2<bool>::my_from2 $ SPURIOUS: method=MyFrom2<i64>::my_from2
MyFrom2::my_from2(73i64, 0i64); // $ MISSING: method=MyFrom2<i64>::my_from2 $ SPURIOUS: method=MyFrom2::my_from2
let x = i64::my_from(73i64); // $ method=MyFrom<i64>::my_from
let y = i64::my_from(true); // $ method=MyFrom<bool>::my_from
let z: i64 = MyFrom::my_from(73i64); // $ method=MyFrom<i64>::my_from
i64::my_from2(73i64, 0i64); // $ method=MyFrom2<i64>::my_from2
i64::my_from2(true, 0i64); // $ method=MyFrom2<bool>::my_from2
MyFrom2::my_from2(73i64, 0i64); // $ method=MyFrom2<i64>::my_from2
i64::f1(73i64); // $ method=MySelfTrait<i64>::f1
i64::f2(73i64); // $ method=MySelfTrait<i64>::f2
bool::f1(true); // $ method=MySelfTrait<bool>::f1
bool::f2(true); // $ method=MySelfTrait<bool>::f2
MySelfTrait::f1(73i64); // $ SPURIOUS method=MySelfTrait::f1 MISSING: method=MySelfTrait<i64>::f1
MySelfTrait::f2(73i64); // $ SPURIOUS method=MySelfTrait::f2 MISSING: method=MySelfTrait<i64>::f2
MySelfTrait::f1(true); // $ SPURIOUS method=MySelfTrait::f1 MISSING: method=MySelfTrait<bool>::f1
MySelfTrait::f2(true); // $ SPURIOUS method=MySelfTrait::f2 MISSING: method=MySelfTrait<bool>::f2
MySelfTrait::f1(73i64); // $ method=MySelfTrait<i64>::f1
MySelfTrait::f2(73i64); // $ method=MySelfTrait<i64>::f2
MySelfTrait::f1(true); // $ method=MySelfTrait<bool>::f1
MySelfTrait::f2(true); // $ method=MySelfTrait<bool>::f2
}
}

View File

@@ -273,14 +273,11 @@ inferType
| main.rs:117:17:117:17 | x | | main.rs:99:5:102:5 | MyThing |
| main.rs:117:17:117:32 | x.trait_method() | | {EXTERNAL LOCATION} | bool |
| main.rs:119:13:119:13 | y | | main.rs:99:5:102:5 | MyThing |
| main.rs:119:13:119:13 | y | | main.rs:104:5:106:5 | trait MyTrait |
| main.rs:119:17:119:40 | MyThing {...} | | main.rs:99:5:102:5 | MyThing |
| main.rs:119:17:119:40 | MyThing {...} | | main.rs:104:5:106:5 | trait MyTrait |
| main.rs:119:34:119:38 | false | | {EXTERNAL LOCATION} | bool |
| main.rs:120:13:120:13 | b | | {EXTERNAL LOCATION} | bool |
| main.rs:120:17:120:40 | ...::trait_method(...) | | {EXTERNAL LOCATION} | bool |
| main.rs:120:39:120:39 | y | | main.rs:99:5:102:5 | MyThing |
| main.rs:120:39:120:39 | y | | main.rs:104:5:106:5 | trait MyTrait |
| main.rs:137:15:137:18 | SelfParam | | main.rs:125:5:128:5 | MyThing |
| main.rs:137:15:137:18 | SelfParam | A | main.rs:130:5:131:14 | S1 |
| main.rs:137:27:139:9 | { ... } | | main.rs:130:5:131:14 | S1 |
@@ -1988,18 +1985,13 @@ inferType
| main.rs:1335:20:1335:24 | &true | | file://:0:0:0:0 | & |
| main.rs:1335:20:1335:24 | &true | &T | {EXTERNAL LOCATION} | bool |
| main.rs:1335:21:1335:24 | true | | {EXTERNAL LOCATION} | bool |
| main.rs:1339:13:1339:20 | mut flag | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1339:13:1339:20 | mut flag | | main.rs:1298:5:1301:5 | MyFlag |
| main.rs:1339:24:1339:41 | ...::default(...) | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1339:24:1339:41 | ...::default(...) | | main.rs:1298:5:1301:5 | MyFlag |
| main.rs:1340:22:1340:30 | &mut flag | | file://:0:0:0:0 | & |
| main.rs:1340:22:1340:30 | &mut flag | &T | {EXTERNAL LOCATION} | trait Default |
| main.rs:1340:22:1340:30 | &mut flag | &T | main.rs:1298:5:1301:5 | MyFlag |
| main.rs:1340:27:1340:30 | flag | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1340:27:1340:30 | flag | | main.rs:1298:5:1301:5 | MyFlag |
| main.rs:1341:18:1341:23 | "{:?}\\n" | | file://:0:0:0:0 | & |
| main.rs:1341:18:1341:23 | "{:?}\\n" | &T | {EXTERNAL LOCATION} | str |
| main.rs:1341:26:1341:29 | flag | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1341:26:1341:29 | flag | | main.rs:1298:5:1301:5 | MyFlag |
| main.rs:1356:43:1359:5 | { ... } | | {EXTERNAL LOCATION} | Result |
| main.rs:1356:43:1359:5 | { ... } | E | main.rs:1348:5:1349:14 | S1 |
@@ -2856,9 +2848,7 @@ inferType
| main.rs:1799:13:1799:20 | vec2_not | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1799:24:1799:26 | ! ... | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1799:25:1799:26 | v1 | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1802:13:1802:24 | default_vec2 | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1802:13:1802:24 | default_vec2 | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1802:28:1802:45 | ...::default(...) | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1802:28:1802:45 | ...::default(...) | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1803:13:1803:26 | vec2_zero_plus | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1803:30:1803:48 | Vec2 {...} | | main.rs:1443:5:1448:5 | Vec2 |
@@ -2867,11 +2857,8 @@ inferType
| main.rs:1803:40:1803:40 | 0 | | {EXTERNAL LOCATION} | i64 |
| main.rs:1803:46:1803:46 | 0 | | {EXTERNAL LOCATION} | i32 |
| main.rs:1803:46:1803:46 | 0 | | {EXTERNAL LOCATION} | i64 |
| main.rs:1803:52:1803:63 | default_vec2 | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1803:52:1803:63 | default_vec2 | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1807:13:1807:24 | default_vec2 | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1807:13:1807:24 | default_vec2 | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1807:28:1807:45 | ...::default(...) | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1807:28:1807:45 | ...::default(...) | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1808:13:1808:26 | vec2_zero_plus | | {EXTERNAL LOCATION} | bool |
| main.rs:1808:30:1808:48 | Vec2 {...} | | main.rs:1443:5:1448:5 | Vec2 |
@@ -2880,7 +2867,6 @@ inferType
| main.rs:1808:40:1808:40 | 0 | | {EXTERNAL LOCATION} | i64 |
| main.rs:1808:46:1808:46 | 0 | | {EXTERNAL LOCATION} | i32 |
| main.rs:1808:46:1808:46 | 0 | | {EXTERNAL LOCATION} | i64 |
| main.rs:1808:53:1808:64 | default_vec2 | | {EXTERNAL LOCATION} | trait Default |
| main.rs:1808:53:1808:64 | default_vec2 | | main.rs:1443:5:1448:5 | Vec2 |
| main.rs:1818:18:1818:21 | SelfParam | | main.rs:1815:5:1815:14 | S1 |
| main.rs:1821:25:1823:5 | { ... } | | main.rs:1815:5:1815:14 | S1 |
@@ -3229,28 +3215,19 @@ inferType
| main.rs:2127:25:2127:28 | 3i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2129:13:2129:13 | x | | {EXTERNAL LOCATION} | i64 |
| main.rs:2129:17:2129:35 | ...::my_from(...) | | {EXTERNAL LOCATION} | i64 |
| main.rs:2129:30:2129:34 | 73i64 | | {EXTERNAL LOCATION} | bool |
| main.rs:2129:30:2129:34 | 73i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2130:13:2130:13 | y | | {EXTERNAL LOCATION} | i64 |
| main.rs:2130:17:2130:34 | ...::my_from(...) | | {EXTERNAL LOCATION} | i64 |
| main.rs:2130:30:2130:33 | true | | {EXTERNAL LOCATION} | bool |
| main.rs:2130:30:2130:33 | true | | {EXTERNAL LOCATION} | i64 |
| main.rs:2131:13:2131:13 | z | | {EXTERNAL LOCATION} | i64 |
| main.rs:2131:13:2131:13 | z | | main.rs:2045:5:2048:5 | trait MyFrom |
| main.rs:2131:22:2131:43 | ...::my_from(...) | | {EXTERNAL LOCATION} | i64 |
| main.rs:2131:22:2131:43 | ...::my_from(...) | | main.rs:2045:5:2048:5 | trait MyFrom |
| main.rs:2131:38:2131:42 | 73i64 | | {EXTERNAL LOCATION} | bool |
| main.rs:2131:38:2131:42 | 73i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2132:23:2132:27 | 73i64 | | {EXTERNAL LOCATION} | bool |
| main.rs:2132:23:2132:27 | 73i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2132:30:2132:33 | 0i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2133:23:2133:26 | true | | {EXTERNAL LOCATION} | bool |
| main.rs:2133:23:2133:26 | true | | {EXTERNAL LOCATION} | i64 |
| main.rs:2133:29:2133:32 | 0i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2134:27:2134:31 | 73i64 | | {EXTERNAL LOCATION} | bool |
| main.rs:2134:27:2134:31 | 73i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2134:34:2134:37 | 0i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2134:34:2134:37 | 0i64 | | main.rs:2064:5:2067:5 | trait MyFrom2 |
| main.rs:2136:9:2136:22 | ...::f1(...) | | {EXTERNAL LOCATION} | i64 |
| main.rs:2136:17:2136:21 | 73i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2137:9:2137:22 | ...::f2(...) | | {EXTERNAL LOCATION} | i64 |
@@ -3261,18 +3238,12 @@ inferType
| main.rs:2139:18:2139:21 | true | | {EXTERNAL LOCATION} | bool |
| main.rs:2140:9:2140:30 | ...::f1(...) | | {EXTERNAL LOCATION} | i64 |
| main.rs:2140:25:2140:29 | 73i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2140:25:2140:29 | 73i64 | | main.rs:2087:5:2093:5 | trait MySelfTrait |
| main.rs:2141:9:2141:30 | ...::f2(...) | | {EXTERNAL LOCATION} | i64 |
| main.rs:2141:9:2141:30 | ...::f2(...) | | main.rs:2087:5:2093:5 | trait MySelfTrait |
| main.rs:2141:25:2141:29 | 73i64 | | {EXTERNAL LOCATION} | i64 |
| main.rs:2141:25:2141:29 | 73i64 | | main.rs:2087:5:2093:5 | trait MySelfTrait |
| main.rs:2142:9:2142:29 | ...::f1(...) | | {EXTERNAL LOCATION} | i64 |
| main.rs:2142:25:2142:28 | true | | {EXTERNAL LOCATION} | bool |
| main.rs:2142:25:2142:28 | true | | main.rs:2087:5:2093:5 | trait MySelfTrait |
| main.rs:2143:9:2143:29 | ...::f2(...) | | {EXTERNAL LOCATION} | bool |
| main.rs:2143:9:2143:29 | ...::f2(...) | | main.rs:2087:5:2093:5 | trait MySelfTrait |
| main.rs:2143:25:2143:28 | true | | {EXTERNAL LOCATION} | bool |
| main.rs:2143:25:2143:28 | true | | main.rs:2087:5:2093:5 | trait MySelfTrait |
| main.rs:2151:26:2153:9 | { ... } | | main.rs:2148:5:2148:24 | MyCallable |
| main.rs:2152:13:2152:25 | MyCallable {...} | | main.rs:2148:5:2148:24 | MyCallable |
| main.rs:2155:17:2155:21 | SelfParam | | file://:0:0:0:0 | & |
@@ -3526,10 +3497,8 @@ inferType
| main.rs:2229:32:2229:32 | 3 | | {EXTERNAL LOCATION} | u16 |
| main.rs:2232:13:2232:17 | vals5 | | {EXTERNAL LOCATION} | Vec |
| main.rs:2232:13:2232:17 | vals5 | A | {EXTERNAL LOCATION} | Global |
| main.rs:2232:13:2232:17 | vals5 | T | {EXTERNAL LOCATION} | u8 |
| main.rs:2232:21:2232:43 | ...::from(...) | | {EXTERNAL LOCATION} | Vec |
| main.rs:2232:21:2232:43 | ...::from(...) | A | {EXTERNAL LOCATION} | Global |
| main.rs:2232:21:2232:43 | ...::from(...) | T | {EXTERNAL LOCATION} | u8 |
| main.rs:2232:31:2232:42 | [...] | | file://:0:0:0:0 | [] |
| main.rs:2232:31:2232:42 | [...] | [T;...] | {EXTERNAL LOCATION} | i32 |
| main.rs:2232:31:2232:42 | [...] | [T;...] | {EXTERNAL LOCATION} | u32 |
@@ -3540,13 +3509,10 @@ inferType
| main.rs:2232:41:2232:41 | 3 | | {EXTERNAL LOCATION} | i32 |
| main.rs:2232:41:2232:41 | 3 | | {EXTERNAL LOCATION} | u32 |
| main.rs:2233:13:2233:13 | u | | {EXTERNAL LOCATION} | Vec |
| main.rs:2233:13:2233:13 | u | | {EXTERNAL LOCATION} | u8 |
| main.rs:2233:13:2233:13 | u | | file://:0:0:0:0 | & |
| main.rs:2233:13:2233:13 | u | A | {EXTERNAL LOCATION} | Global |
| main.rs:2233:13:2233:13 | u | T | {EXTERNAL LOCATION} | u8 |
| main.rs:2233:18:2233:22 | vals5 | | {EXTERNAL LOCATION} | Vec |
| main.rs:2233:18:2233:22 | vals5 | A | {EXTERNAL LOCATION} | Global |
| main.rs:2233:18:2233:22 | vals5 | T | {EXTERNAL LOCATION} | u8 |
| main.rs:2235:13:2235:17 | vals6 | | {EXTERNAL LOCATION} | Vec |
| main.rs:2235:13:2235:17 | vals6 | A | {EXTERNAL LOCATION} | Global |
| main.rs:2235:13:2235:17 | vals6 | T | file://:0:0:0:0 | & |
@@ -3693,7 +3659,6 @@ inferType
| main.rs:2304:13:2304:14 | x6 | T4 | main.rs:2273:5:2274:14 | S2 |
| main.rs:2304:18:2304:45 | S4::<...>(...) | | main.rs:2292:5:2292:27 | S4 |
| main.rs:2304:18:2304:45 | S4::<...>(...) | T4 | main.rs:2273:5:2274:14 | S2 |
| main.rs:2304:27:2304:44 | ...::default(...) | | {EXTERNAL LOCATION} | trait Default |
| main.rs:2304:27:2304:44 | ...::default(...) | | main.rs:2273:5:2274:14 | S2 |
| main.rs:2305:13:2305:14 | x7 | | main.rs:2292:5:2292:27 | S4 |
| main.rs:2305:13:2305:14 | x7 | T4 | main.rs:2273:5:2274:14 | S2 |
@@ -3711,12 +3676,9 @@ inferType
| main.rs:2307:18:2307:34 | S4(...) | T4 | main.rs:2273:5:2274:14 | S2 |
| main.rs:2307:21:2307:33 | ...::default(...) | | main.rs:2273:5:2274:14 | S2 |
| main.rs:2308:13:2308:15 | x10 | | main.rs:2294:5:2296:5 | S5 |
| main.rs:2308:13:2308:15 | x10 | T5 | {EXTERNAL LOCATION} | trait Default |
| main.rs:2308:13:2308:15 | x10 | T5 | main.rs:2273:5:2274:14 | S2 |
| main.rs:2308:19:2311:9 | S5::<...> {...} | | main.rs:2294:5:2296:5 | S5 |
| main.rs:2308:19:2311:9 | S5::<...> {...} | T5 | {EXTERNAL LOCATION} | trait Default |
| main.rs:2308:19:2311:9 | S5::<...> {...} | T5 | main.rs:2273:5:2274:14 | S2 |
| main.rs:2310:20:2310:37 | ...::default(...) | | {EXTERNAL LOCATION} | trait Default |
| main.rs:2310:20:2310:37 | ...::default(...) | | main.rs:2273:5:2274:14 | S2 |
| main.rs:2312:13:2312:15 | x11 | | main.rs:2294:5:2296:5 | S5 |
| main.rs:2312:13:2312:15 | x11 | T5 | main.rs:2273:5:2274:14 | S2 |

View File

@@ -1,9 +0,0 @@
multipleCallTargets
| src/main.rs:8:21:8:44 | ...::from(...) |
| src/main.rs:19:21:19:44 | ...::from(...) |
| src/main.rs:25:23:25:59 | ...::from(...) |
| src/main.rs:26:38:26:61 | ...::from(...) |
| src/main.rs:39:23:39:59 | ...::from(...) |
| src/main.rs:40:38:40:61 | ...::from(...) |
| src/main.rs:52:23:52:59 | ...::from(...) |
| src/main.rs:53:38:53:61 | ...::from(...) |

View File

@@ -1,11 +1,11 @@
#select
| src/main.rs:10:5:10:22 | ...::read_to_string | src/main.rs:6:11:6:19 | file_name | src/main.rs:10:5:10:22 | ...::read_to_string | This path depends on a $@. | src/main.rs:6:11:6:19 | file_name | user-provided value |
edges
| src/main.rs:6:11:6:19 | file_name | src/main.rs:8:35:8:43 | file_name | provenance | |
| src/main.rs:6:11:6:19 | file_name | src/main.rs:8:35:8:53 | file_name as String | provenance | |
| src/main.rs:8:9:8:17 | file_path | src/main.rs:10:24:10:32 | file_path | provenance | |
| src/main.rs:8:21:8:44 | ...::from(...) | src/main.rs:8:9:8:17 | file_path | provenance | |
| src/main.rs:8:35:8:43 | file_name | src/main.rs:8:21:8:44 | ...::from(...) | provenance | MaD:2 |
| src/main.rs:8:35:8:43 | file_name | src/main.rs:8:21:8:44 | ...::from(...) | provenance | MaD:2 |
| src/main.rs:8:21:8:54 | ...::from(...) | src/main.rs:8:9:8:17 | file_path | provenance | |
| src/main.rs:8:35:8:53 | file_name as String | src/main.rs:8:21:8:54 | ...::from(...) | provenance | MaD:2 |
| src/main.rs:8:35:8:53 | file_name as String | src/main.rs:8:21:8:54 | ...::from(...) | provenance | MaD:2 |
| src/main.rs:10:24:10:32 | file_path | src/main.rs:10:5:10:22 | ...::read_to_string | provenance | MaD:1 Sink:MaD:1 |
models
| 1 | Sink: std::fs::read_to_string; Argument[0]; path-injection |
@@ -13,8 +13,8 @@ models
nodes
| src/main.rs:6:11:6:19 | file_name | semmle.label | file_name |
| src/main.rs:8:9:8:17 | file_path | semmle.label | file_path |
| src/main.rs:8:21:8:44 | ...::from(...) | semmle.label | ...::from(...) |
| src/main.rs:8:35:8:43 | file_name | semmle.label | file_name |
| src/main.rs:8:21:8:54 | ...::from(...) | semmle.label | ...::from(...) |
| src/main.rs:8:35:8:53 | file_name as String | semmle.label | file_name as String |
| src/main.rs:10:5:10:22 | ...::read_to_string | semmle.label | ...::read_to_string |
| src/main.rs:10:24:10:32 | file_path | semmle.label | file_path |
subpaths

View File

@@ -5,8 +5,8 @@ use std::{fs, path::Path, path::PathBuf};
fn tainted_path_handler_bad(
Query(file_name): Query<String>, // $ Source=remote1
) -> Result<String> {
let file_path = PathBuf::from(file_name);
// BAD: This could read any file on the filesystem.
let file_path = PathBuf::from(file_name as String); // TODO: Remove `as String` when type inference handles patterns
// BAD: This could read any file on the filesystem.
fs::read_to_string(file_path).map_err(InternalServerError) // $ path-injection-sink Alert[rust/path-injection]=remote1
}