Skip to content

Commit 88439b4

Browse files
authored
Merge pull request #19095 from geoffw0/blockon
Rust: Model futures::executor::block_on.
2 parents 7c63264 + f292d04 commit 88439b4

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/rust-all
4+
extensible: summaryModel
5+
data:
6+
- ["repo:https://github.com/rust-lang/futures-rs:futures-executor", "crate::local_pool::block_on", "Argument[0]", "ReturnValue", "value", "manual"]

rust/ql/test/library-tests/dataflow/global/inline-flow.expected

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
models
2+
| 1 | Summary: repo:https://github.com/rust-lang/futures-rs:futures-executor; crate::local_pool::block_on; Argument[0]; ReturnValue; value |
23
edges
34
| main.rs:12:28:14:1 | { ... } | main.rs:17:13:17:23 | get_data(...) | provenance | |
45
| main.rs:13:5:13:13 | source(...) | main.rs:12:28:14:1 | { ... } | provenance | |
@@ -91,10 +92,15 @@ edges
9192
| main.rs:188:9:188:9 | d [MyInt] | main.rs:189:10:189:10 | d [MyInt] | provenance | |
9293
| main.rs:188:13:188:20 | a.add(...) [MyInt] | main.rs:188:9:188:9 | d [MyInt] | provenance | |
9394
| main.rs:189:10:189:10 | d [MyInt] | main.rs:189:10:189:16 | d.value | provenance | |
95+
| main.rs:227:32:231:1 | { ... } | main.rs:246:41:246:54 | async_source(...) | provenance | |
96+
| main.rs:228:9:228:9 | a | main.rs:227:32:231:1 | { ... } | provenance | |
9497
| main.rs:228:9:228:9 | a | main.rs:229:10:229:10 | a | provenance | |
9598
| main.rs:228:13:228:21 | source(...) | main.rs:228:9:228:9 | a | provenance | |
9699
| main.rs:238:13:238:13 | c | main.rs:239:14:239:14 | c | provenance | |
97100
| main.rs:238:17:238:25 | source(...) | main.rs:238:13:238:13 | c | provenance | |
101+
| main.rs:246:9:246:9 | a | main.rs:247:10:247:10 | a | provenance | |
102+
| main.rs:246:13:246:55 | ...::block_on(...) | main.rs:246:9:246:9 | a | provenance | |
103+
| main.rs:246:41:246:54 | async_source(...) | main.rs:246:13:246:55 | ...::block_on(...) | provenance | MaD:1 |
98104
nodes
99105
| main.rs:12:28:14:1 | { ... } | semmle.label | { ... } |
100106
| main.rs:13:5:13:13 | source(...) | semmle.label | source(...) |
@@ -196,12 +202,17 @@ nodes
196202
| main.rs:188:13:188:20 | a.add(...) [MyInt] | semmle.label | a.add(...) [MyInt] |
197203
| main.rs:189:10:189:10 | d [MyInt] | semmle.label | d [MyInt] |
198204
| main.rs:189:10:189:16 | d.value | semmle.label | d.value |
205+
| main.rs:227:32:231:1 | { ... } | semmle.label | { ... } |
199206
| main.rs:228:9:228:9 | a | semmle.label | a |
200207
| main.rs:228:13:228:21 | source(...) | semmle.label | source(...) |
201208
| main.rs:229:10:229:10 | a | semmle.label | a |
202209
| main.rs:238:13:238:13 | c | semmle.label | c |
203210
| main.rs:238:17:238:25 | source(...) | semmle.label | source(...) |
204211
| main.rs:239:14:239:14 | c | semmle.label | c |
212+
| main.rs:246:9:246:9 | a | semmle.label | a |
213+
| main.rs:246:13:246:55 | ...::block_on(...) | semmle.label | ...::block_on(...) |
214+
| main.rs:246:41:246:54 | async_source(...) | semmle.label | async_source(...) |
215+
| main.rs:247:10:247:10 | a | semmle.label | a |
205216
subpaths
206217
| main.rs:38:23:38:31 | source(...) | main.rs:26:28:26:33 | ...: i64 | main.rs:26:17:26:25 | SelfParam [Return] [&ref, MyStruct] | main.rs:38:6:38:11 | [post] &mut a [&ref, MyStruct] |
207218
| main.rs:39:10:39:10 | a [MyStruct] | main.rs:30:17:30:21 | SelfParam [&ref, MyStruct] | main.rs:30:31:32:5 | { ... } | main.rs:39:10:39:21 | a.get_data() |
@@ -232,3 +243,4 @@ testFailures
232243
| main.rs:189:10:189:16 | d.value | main.rs:186:28:186:36 | source(...) | main.rs:189:10:189:16 | d.value | $@ | main.rs:186:28:186:36 | source(...) | source(...) |
233244
| main.rs:229:10:229:10 | a | main.rs:228:13:228:21 | source(...) | main.rs:229:10:229:10 | a | $@ | main.rs:228:13:228:21 | source(...) | source(...) |
234245
| main.rs:239:14:239:14 | c | main.rs:238:17:238:25 | source(...) | main.rs:239:14:239:14 | c | $@ | main.rs:238:17:238:25 | source(...) | source(...) |
246+
| main.rs:247:10:247:10 | a | main.rs:228:13:228:21 | source(...) | main.rs:247:10:247:10 | a | $@ | main.rs:228:13:228:21 | source(...) | source(...) |

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ async fn test_async_await_async_part() {
244244

245245
fn test_async_await() {
246246
let a = futures::executor::block_on(async_source());
247-
sink(a); // $ MISSING: hasValueFlow=1
247+
sink(a); // $ hasValueFlow=1
248248

249249
futures::executor::block_on(test_async_await_async_part());
250250
}

rust/ql/test/library-tests/dataflow/global/viableCallable.expected

+2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@
6060
| main.rs:238:17:238:25 | source(...) | main.rs:1:1:3:1 | fn source |
6161
| main.rs:239:9:239:15 | sink(...) | main.rs:5:1:7:1 | fn sink |
6262
| main.rs:242:5:242:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
63+
| main.rs:246:13:246:55 | ...::block_on(...) | file://:0:0:0:0 | repo:https://github.com/rust-lang/futures-rs:futures-executor::_::crate::local_pool::block_on |
6364
| main.rs:246:41:246:54 | async_source(...) | main.rs:227:1:231:1 | fn async_source |
6465
| main.rs:247:5:247:11 | sink(...) | main.rs:5:1:7:1 | fn sink |
66+
| main.rs:249:5:249:62 | ...::block_on(...) | file://:0:0:0:0 | repo:https://github.com/rust-lang/futures-rs:futures-executor::_::crate::local_pool::block_on |
6567
| main.rs:249:33:249:61 | test_async_await_async_part(...) | main.rs:233:1:243:1 | fn test_async_await_async_part |
6668
| main.rs:253:5:253:22 | data_out_of_call(...) | main.rs:16:1:19:1 | fn data_out_of_call |
6769
| main.rs:254:5:254:35 | data_out_of_call_side_effect1(...) | main.rs:35:1:40:1 | fn data_out_of_call_side_effect1 |

rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected

+1
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,7 @@ models
19211921
| 1058 | Summary: lang:std; crate::thread::current::set_current; Argument[0]; ReturnValue.Field[crate::result::Result::Err(0)]; value |
19221922
| 1059 | Summary: lang:std; crate::thread::current::try_with_current; Argument[0].ReturnValue; ReturnValue; value |
19231923
| 1060 | Summary: lang:std; crate::thread::with_current_name; Argument[0].ReturnValue; ReturnValue; value |
1924+
| 1061 | Summary: repo:https://github.com/rust-lang/futures-rs:futures-executor; crate::local_pool::block_on; Argument[0]; ReturnValue; value |
19241925
storeStep
19251926
| file://:0:0:0:0 | [summary] to write: Argument[0].Field[crate::option::Option::Some(0)] in lang:core::_::<crate::option::Option>::zip_with | Some | file://:0:0:0:0 | [post] [summary param] 0 in lang:core::_::<crate::option::Option>::zip_with |
19261927
| file://:0:0:0:0 | [summary] to write: Argument[0].Parameter[0].Reference in lang:alloc::_::<crate::collections::vec_deque::VecDeque>::retain | &ref | file://:0:0:0:0 | [summary] to write: Argument[0].Parameter[0] in lang:alloc::_::<crate::collections::vec_deque::VecDeque>::retain |

rust/ql/test/query-tests/security/CWE-020/RegexInjection.expected

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
| main.rs:6:25:6:30 | &regex | main.rs:4:20:4:32 | ...::var | main.rs:6:25:6:30 | &regex | This regular expression is constructed from a $@. | main.rs:4:20:4:32 | ...::var | user-provided value |
33
edges
44
| main.rs:4:9:4:16 | username | main.rs:5:25:5:44 | MacroExpr | provenance | |
5-
| main.rs:4:20:4:32 | ...::var | main.rs:4:20:4:40 | ...::var(...) [Ok] | provenance | Src:MaD:65 |
6-
| main.rs:4:20:4:40 | ...::var(...) [Ok] | main.rs:4:20:4:66 | ... .unwrap_or(...) | provenance | MaD:1640 |
5+
| main.rs:4:20:4:32 | ...::var | main.rs:4:20:4:40 | ...::var(...) [Ok] | provenance | Src:MaD:66 |
6+
| main.rs:4:20:4:40 | ...::var(...) [Ok] | main.rs:4:20:4:66 | ... .unwrap_or(...) | provenance | MaD:1641 |
77
| main.rs:4:20:4:66 | ... .unwrap_or(...) | main.rs:4:9:4:16 | username | provenance | |
88
| main.rs:5:9:5:13 | regex | main.rs:6:26:6:30 | regex | provenance | |
99
| main.rs:5:17:5:45 | res | main.rs:5:25:5:44 | { ... } | provenance | |
1010
| main.rs:5:25:5:44 | ...::format(...) | main.rs:5:17:5:45 | res | provenance | |
1111
| main.rs:5:25:5:44 | ...::must_use(...) | main.rs:5:9:5:13 | regex | provenance | |
12-
| main.rs:5:25:5:44 | MacroExpr | main.rs:5:25:5:44 | ...::format(...) | provenance | MaD:101 |
13-
| main.rs:5:25:5:44 | { ... } | main.rs:5:25:5:44 | ...::must_use(...) | provenance | MaD:3063 |
12+
| main.rs:5:25:5:44 | MacroExpr | main.rs:5:25:5:44 | ...::format(...) | provenance | MaD:102 |
13+
| main.rs:5:25:5:44 | { ... } | main.rs:5:25:5:44 | ...::must_use(...) | provenance | MaD:3064 |
1414
| main.rs:6:26:6:30 | regex | main.rs:6:25:6:30 | &regex | provenance | |
1515
nodes
1616
| main.rs:4:9:4:16 | username | semmle.label | username |

0 commit comments

Comments
 (0)