Skip to content

Commit 12dcd75

Browse files
committed
Rust: Accept test changes
1 parent 29ba013 commit 12dcd75

File tree

8 files changed

+86
-40
lines changed

8 files changed

+86
-40
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,12 +1005,15 @@ readStep
10051005
| main.rs:458:5:458:11 | mut_arr | file://:0:0:0:0 | element | main.rs:458:5:458:14 | mut_arr[1] |
10061006
| main.rs:459:13:459:19 | mut_arr | file://:0:0:0:0 | element | main.rs:459:13:459:22 | mut_arr[1] |
10071007
| main.rs:461:10:461:16 | mut_arr | file://:0:0:0:0 | element | main.rs:461:10:461:19 | mut_arr[0] |
1008+
| main.rs:467:24:467:33 | [post] receiver for source(...) | file://:0:0:0:0 | &ref | main.rs:467:24:467:33 | [post] source(...) |
10081009
| main.rs:468:9:468:20 | TuplePat | file://:0:0:0:0 | tuple.0 | main.rs:468:10:468:13 | cond |
10091010
| main.rs:468:9:468:20 | TuplePat | file://:0:0:0:0 | tuple.1 | main.rs:468:16:468:19 | name |
10101011
| main.rs:468:25:468:29 | names | file://:0:0:0:0 | element | main.rs:468:9:468:20 | TuplePat |
10111012
| main.rs:470:41:470:67 | [post] \|...\| ... | main.rs:467:9:467:20 | captured default_name | main.rs:470:41:470:67 | [post] default_name |
1013+
| main.rs:470:44:470:55 | [post] receiver for default_name | file://:0:0:0:0 | &ref | main.rs:470:44:470:55 | [post] default_name |
10121014
| main.rs:470:44:470:55 | this | main.rs:467:9:467:20 | captured default_name | main.rs:470:44:470:55 | default_name |
10131015
| main.rs:471:18:471:18 | [post] receiver for n | file://:0:0:0:0 | &ref | main.rs:471:18:471:18 | [post] n |
1016+
| main.rs:494:13:494:13 | [post] receiver for a | file://:0:0:0:0 | &ref | main.rs:494:13:494:13 | [post] a |
10141017
| main.rs:495:13:495:13 | [post] receiver for b | file://:0:0:0:0 | &ref | main.rs:495:13:495:13 | [post] b |
10151018
| main.rs:496:18:496:18 | [post] receiver for b | file://:0:0:0:0 | &ref | main.rs:496:18:496:18 | [post] b |
10161019
| main.rs:507:10:507:11 | vs | file://:0:0:0:0 | element | main.rs:507:10:507:14 | vs[0] |
@@ -1110,8 +1113,11 @@ storeStep
11101113
| main.rs:455:27:455:27 | 2 | file://:0:0:0:0 | element | main.rs:455:23:455:31 | [...] |
11111114
| main.rs:455:30:455:30 | 3 | file://:0:0:0:0 | element | main.rs:455:23:455:31 | [...] |
11121115
| main.rs:458:18:458:27 | source(...) | file://:0:0:0:0 | element | main.rs:458:5:458:11 | [post] mut_arr |
1116+
| main.rs:467:24:467:33 | source(...) | file://:0:0:0:0 | &ref | main.rs:467:24:467:33 | receiver for source(...) |
11131117
| main.rs:470:41:470:67 | default_name | main.rs:467:9:467:20 | captured default_name | main.rs:470:41:470:67 | \|...\| ... |
1118+
| main.rs:470:44:470:55 | default_name | file://:0:0:0:0 | &ref | main.rs:470:44:470:55 | receiver for default_name |
11141119
| main.rs:471:18:471:18 | n | file://:0:0:0:0 | &ref | main.rs:471:18:471:18 | receiver for n |
1120+
| main.rs:494:13:494:13 | a | file://:0:0:0:0 | &ref | main.rs:494:13:494:13 | receiver for a |
11151121
| main.rs:495:13:495:13 | b | file://:0:0:0:0 | &ref | main.rs:495:13:495:13 | receiver for b |
11161122
| main.rs:496:18:496:18 | b | file://:0:0:0:0 | &ref | main.rs:496:18:496:18 | receiver for b |
11171123
| main.rs:505:15:505:24 | source(...) | file://:0:0:0:0 | element | main.rs:505:14:505:34 | [...] |

rust/ql/test/library-tests/dataflow/sources/CONSISTENCY/PathResolutionConsistency.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ multipleCallTargets
7373
| test.rs:977:14:977:29 | ...::_print(...) |
7474
| test.rs:979:27:979:36 | ...::_print(...) |
7575
| test.rs:980:28:980:41 | ...::_print(...) |
76+
| test_futures_io.rs:45:27:45:84 | ...::read(...) |
77+
| test_futures_io.rs:49:27:49:51 | reader.read(...) |
78+
| test_futures_io.rs:83:22:83:39 | reader2.fill_buf() |
79+
| test_futures_io.rs:103:27:103:85 | ...::read(...) |
80+
| test_futures_io.rs:107:27:107:52 | reader2.read(...) |
81+
| test_futures_io.rs:125:22:125:39 | reader2.fill_buf() |
82+
| test_futures_io.rs:132:27:132:62 | reader2.read_until(...) |
83+
| test_futures_io.rs:139:27:139:54 | reader2.read_line(...) |
84+
| test_futures_io.rs:146:27:146:58 | reader2.read_to_end(...) |
85+
| test_futures_io.rs:152:32:152:46 | reader2.lines() |
86+
| test_futures_io.rs:153:14:153:32 | lines_stream.next() |
87+
| test_futures_io.rs:154:32:154:50 | lines_stream.next() |
7688
| web_frameworks.rs:13:14:13:22 | a.as_str() |
7789
| web_frameworks.rs:13:14:13:23 | a.as_str() |
7890
| web_frameworks.rs:14:14:14:24 | a.as_bytes() |

rust/ql/test/library-tests/dataflow/sources/test.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -309,28 +309,28 @@ async fn test_tokio_stdin() -> Result<(), Box<dyn std::error::Error>> {
309309
let mut stdin = tokio::io::stdin(); // $ Alert[rust/summary/taint-sources]
310310
let mut buffer = [0u8; 100];
311311
let _bytes = stdin.read(&mut buffer).await?;
312-
sink(&buffer); // $ MISSING: hasTaintFlow -- we cannot resolve the `read` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
312+
sink(&buffer); // $ hasTaintFlow
313313
}
314314

315315
{
316316
let mut stdin = tokio::io::stdin(); // $ Alert[rust/summary/taint-sources]
317317
let mut buffer = Vec::<u8>::new();
318318
let _bytes = stdin.read_to_end(&mut buffer).await?;
319-
sink(&buffer); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_to_end` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
319+
sink(&buffer); // $ hasTaintFlow
320320
}
321321

322322
{
323323
let mut stdin = tokio::io::stdin(); // $ Alert[rust/summary/taint-sources]
324324
let mut buffer = String::new();
325325
let _bytes = stdin.read_to_string(&mut buffer).await?;
326-
sink(&buffer); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_to_string` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
326+
sink(&buffer); // $ hasTaintFlow
327327
}
328328

329329
{
330330
let mut stdin = tokio::io::stdin(); // $ Alert[rust/summary/taint-sources]
331331
let mut buffer = [0; 100];
332332
stdin.read_exact(&mut buffer).await?;
333-
sink(&buffer); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_exact` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
333+
sink(&buffer); // $ hasTaintFlow
334334
}
335335

336336
{
@@ -339,25 +339,25 @@ async fn test_tokio_stdin() -> Result<(), Box<dyn std::error::Error>> {
339339
let v2 = stdin.read_i16().await?;
340340
let v3 = stdin.read_f32().await?;
341341
let v4 = stdin.read_i64_le().await?;
342-
sink(v1); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_u8` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
343-
sink(v2); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_i16` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
344-
sink(v3); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_f32` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
345-
sink(v4); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_i64_le` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
342+
sink(v1); // $ hasTaintFlow
343+
sink(v2); // $ hasTaintFlow
344+
sink(v3); // $ hasTaintFlow
345+
sink(v4); // $ hasTaintFlow
346346
}
347347

348348
{
349349
let mut stdin = tokio::io::stdin(); // $ Alert[rust/summary/taint-sources]
350350
let mut buffer = bytes::BytesMut::new();
351351
stdin.read_buf(&mut buffer).await?;
352-
sink(&buffer); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_buf` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
352+
sink(&buffer); // $ hasTaintFlow
353353
}
354354

355355
// --- async reading from stdin (BufReader) ---
356356

357357
{
358358
let mut reader = tokio::io::BufReader::new(tokio::io::stdin()); // $ Alert[rust/summary/taint-sources]
359359
let data = reader.fill_buf().await?;
360-
sink(&data); // $ MISSING: hasTaintFlow -- we cannot resolve the `fill_buf` call above, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
360+
sink(&data); // $ hasTaintFlow
361361
}
362362

363363
{
@@ -370,31 +370,31 @@ async fn test_tokio_stdin() -> Result<(), Box<dyn std::error::Error>> {
370370
let mut buffer = String::new();
371371
let mut reader = tokio::io::BufReader::new(tokio::io::stdin()); // $ Alert[rust/summary/taint-sources]
372372
reader.read_line(&mut buffer).await?;
373-
sink(&buffer); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_line` call above, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
373+
sink(&buffer); // $ hasTaintFlow
374374
}
375375

376376
{
377377
let mut buffer = Vec::<u8>::new();
378378
let mut reader = tokio::io::BufReader::new(tokio::io::stdin()); // $ Alert[rust/summary/taint-sources]
379379
reader.read_until(b',', &mut buffer).await?;
380-
sink(&buffer); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_until` call above, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
381-
sink(buffer[0]); // $ MISSING: hasTaintFlow -- we cannot resolve the `read_until` call above, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
380+
sink(&buffer); // $ hasTaintFlow
381+
sink(buffer[0]); // $ hasTaintFlow
382382
}
383383

384384
{
385385
let mut reader_split = tokio::io::BufReader::new(tokio::io::stdin()).split(b','); // $ Alert[rust/summary/taint-sources]
386-
sink(reader_split.next_segment().await?.unwrap()); // $ MISSING: hasTaintFlow -- we cannot resolve the `split` call above, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
386+
sink(reader_split.next_segment().await?.unwrap()); // $ hasTaintFlow
387387
while let Some(chunk) = reader_split.next_segment().await? {
388-
sink(chunk); // $ MISSING: hasTaintFlow
388+
sink(chunk); // $ hasTaintFlow
389389
}
390390
}
391391

392392
{
393393
let reader = tokio::io::BufReader::new(tokio::io::stdin()); // $ Alert[rust/summary/taint-sources]
394394
let mut lines = reader.lines();
395-
sink(lines.next_line().await?.unwrap()); // $ MISSING: hasTaintFlow -- we cannot resolve the `lines` call above, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
395+
sink(lines.next_line().await?.unwrap()); // $ hasTaintFlow
396396
while let Some(line) = lines.next_line().await? {
397-
sink(line); // $ MISSING: hasTaintFlow
397+
sink(line); // $ hasTaintFlow
398398
}
399399
}
400400

@@ -583,42 +583,42 @@ async fn test_tokio_file() -> std::io::Result<()> {
583583
{
584584
let mut buffer = [0u8; 100];
585585
let _bytes = file.read(&mut buffer).await?;
586-
sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
586+
sink(&buffer); // $ hasTaintFlow="file.txt"
587587
}
588588

589589
{
590590
let mut buffer = Vec::<u8>::new();
591591
let _bytes = file.read_to_end(&mut buffer).await?;
592-
sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_to_end` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
592+
sink(&buffer); // $ hasTaintFlow="file.txt"
593593
}
594594

595595
{
596596
let mut buffer = String::new();
597597
let _bytes = file.read_to_string(&mut buffer).await?;
598-
sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_to_string` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
598+
sink(&buffer); // $ hasTaintFlow="file.txt"
599599
}
600600

601601
{
602602
let mut buffer = [0; 100];
603603
file.read_exact(&mut buffer).await?;
604-
sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_exact` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
604+
sink(&buffer); // $ hasTaintFlow="file.txt"
605605
}
606606

607607
{
608608
let v1 = file.read_u8().await?;
609609
let v2 = file.read_i16().await?;
610610
let v3 = file.read_f32().await?;
611611
let v4 = file.read_i64_le().await?;
612-
sink(v1); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_u8` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
613-
sink(v2); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_i16` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
614-
sink(v3); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_f32` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
615-
sink(v4); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_i64_le` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
612+
sink(v1); // $ hasTaintFlow="file.txt"
613+
sink(v2); // $ hasTaintFlow="file.txt"
614+
sink(v3); // $ hasTaintFlow="file.txt"
615+
sink(v4); // $ hasTaintFlow="file.txt"
616616
}
617617

618618
{
619619
let mut buffer = bytes::BytesMut::new();
620620
file.read_buf(&mut buffer).await?;
621-
sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `read_buf` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
621+
sink(&buffer); // $ hasTaintFlow="file.txt"
622622
}
623623

624624
// --- OpenOptions ---
@@ -627,7 +627,7 @@ async fn test_tokio_file() -> std::io::Result<()> {
627627
let mut f1 = tokio::fs::OpenOptions::new().open("f1.txt").await?; // $ Alert[rust/summary/taint-sources]
628628
let mut buffer = [0u8; 1024];
629629
let _bytes = f1.read(&mut buffer).await?;
630-
sink(&buffer); // $ MISSING: hasTaintFlow="f1.txt"
630+
sink(&buffer); // $ hasTaintFlow="f1.txt"
631631
}
632632

633633
// --- misc operations ---
@@ -775,8 +775,8 @@ async fn test_tokio_tcpstream(case: i64) -> std::io::Result<()> {
775775
sink(buffer1[0]); // $ hasTaintFlow=address
776776

777777
println!("buffer2 = {:?}", buffer2);
778-
sink(&buffer2); // $ MISSING: hasTaintFlow=address -- we cannot resolve the `read` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
779-
sink(buffer2[0]); // $ MISSING: hasTaintFlow=address -- we cannot resolve the `read` call above, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
778+
sink(&buffer2); // $ hasTaintFlow=address
779+
sink(buffer2[0]); // $ hasTaintFlow=address
780780

781781
let buffer_string = String::from_utf8_lossy(&buffer2[..n2]);
782782
println!("string = {}", buffer_string);

rust/ql/test/library-tests/dataflow/sources/test_futures_io.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
4343
// using the `AsyncReadExt::read` extension method (higher-level)
4444
let mut buffer1 = [0u8; 64];
4545
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`
46-
sink(&buffer1[..bytes_read1]); // $ MISSING: hasTaintFlow=url
46+
sink(&buffer1[..bytes_read1]); // $ hasTaintFlow=url
4747

4848
let mut buffer2 = [0u8; 64];
4949
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`
5050

51-
sink(&buffer2[..bytes_read2]); // $ MISSING: hasTaintFlow=url
51+
sink(&buffer2[..bytes_read2]); // $ hasTaintFlow=url
5252
}
5353

5454
let mut reader2 = futures::io::BufReader::new(reader);
@@ -81,7 +81,7 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
8181
{
8282
// using the `AsyncBufReadExt::fill_buf` extension method (higher-level)
8383
let buffer = reader2.fill_buf().await?; // we cannot resolve the `fill_buf` call, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
84-
sink(buffer); // $ MISSING: hasTaintFlow=url
84+
sink(buffer); // $ hasTaintFlow=url
8585
}
8686

8787
{
@@ -101,11 +101,11 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
101101
// using the `AsyncReadExt::read` extension method (higher-level)
102102
let mut buffer1 = [0u8; 64];
103103
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`
104-
sink(&buffer1[..bytes_read1]); // $ MISSING: hasTaintFlow=url
104+
sink(&buffer1[..bytes_read1]); // $ hasTaintFlow=url
105105

106106
let mut buffer2 = [0u8; 64];
107107
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`
108-
sink(&buffer2[..bytes_read2]); // $ MISSING: hasTaintFlow=url
108+
sink(&buffer2[..bytes_read2]); // $ hasTaintFlow=url
109109
}
110110

111111
{
@@ -123,28 +123,28 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
123123
{
124124
// using the `AsyncBufReadExt::fill_buf` extension method (higher-level)
125125
let buffer = reader2.fill_buf().await?; // we cannot resolve the `fill_buf` call, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
126-
sink(buffer); // $ MISSING: hasTaintFlow=url
126+
sink(buffer); // $ hasTaintFlow=url
127127
}
128128

129129
{
130130
// using the `AsyncBufReadExt::read_until` extension method
131131
let mut line = Vec::new();
132132
let _bytes_read = reader2.read_until(b'\n', &mut line).await?; // we cannot resolve the `read_until` call, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
133-
sink(&line); // $ MISSING: hasTaintFlow=url
133+
sink(&line); // $ hasTaintFlow=url
134134
}
135135

136136
{
137137
// using the `AsyncBufReadExt::read_line` extension method
138138
let mut line = String::new();
139139
let _bytes_read = reader2.read_line(&mut line).await?; // we cannot resolve the `read_line` call, which comes from `impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}` in `async_buf_read_ext.rs`
140-
sink(&line); // $ MISSING: hasTaintFlow=url
140+
sink(&line); // $ hasTaintFlow=url
141141
}
142142

143143
{
144144
// using the `AsyncBufReadExt::read_to_end` extension method
145145
let mut buffer = Vec::with_capacity(1024);
146146
let _bytes_read = reader2.read_to_end(&mut buffer).await?; // we cannot resolve the `read` call, which comes from `impl<R: AsyncRead + ?Sized> AsyncReadExt for R {}` in `async_read_ext.rs`
147-
sink(&buffer); // $ MISSING: hasTaintFlow=url
147+
sink(&buffer); // $ hasTaintFlow=url
148148
}
149149

150150
{

rust/ql/test/library-tests/path-resolution/my.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn int_div(
3030
) -> Result<i32> // $ item=my::Result $ item=i32
3131
{
3232
if y == 0 {
33-
return Err("Div by zero".to_string()); // $ item=Err
33+
return Err("Div by zero".to_string()); // $ item=Err item=to_string
3434
}
3535
Ok(x / y) // $ item=Ok
3636
}

rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/PathResolutionConsistency.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ multipleCallTargets
1212
| sqlx.rs:67:26:67:48 | unsafe_query_1.as_str() |
1313
| sqlx.rs:69:30:69:52 | unsafe_query_2.as_str() |
1414
| sqlx.rs:70:30:70:52 | unsafe_query_3.as_str() |
15+
| sqlx.rs:71:30:71:52 | unsafe_query_4.as_str() |
1516
| sqlx.rs:75:25:75:45 | safe_query_1.as_str() |
1617
| sqlx.rs:76:25:76:45 | safe_query_2.as_str() |
1718
| sqlx.rs:77:25:77:45 | safe_query_3.as_str() |
1819
| sqlx.rs:78:25:78:47 | unsafe_query_1.as_str() |
1920
| sqlx.rs:80:29:80:51 | unsafe_query_2.as_str() |
2021
| sqlx.rs:81:29:81:51 | unsafe_query_3.as_str() |
22+
| sqlx.rs:82:29:82:51 | unsafe_query_4.as_str() |
2123
| sqlx.rs:84:25:84:49 | prepared_query_1.as_str() |
2224
| sqlx.rs:85:25:85:49 | prepared_query_1.as_str() |
2325
| sqlx.rs:87:29:87:53 | prepared_query_1.as_str() |

0 commit comments

Comments
 (0)