Skip to content

Commit 4dea5ee

Browse files
committed
Rust: Fix futures_io models.
1 parent 8177b09 commit 4dea5ee

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

rust/ql/lib/codeql/rust/frameworks/futures.model.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ extensions:
55
data:
66
- ["futures_executor::local_pool::block_on", "Argument[0]", "ReturnValue", "value", "manual"]
77
- ["<futures_util::io::buf_reader::BufReader>::new", "Argument[0]", "ReturnValue", "taint", "manual"]
8-
- ["futures-util::io::AsyncReadExt::read", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
9-
- ["futures-util::io::AsyncReadExt::read", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"]
10-
- ["futures-util::io::AsyncReadExt::read_to_end", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
11-
- ["futures-util::io::AsyncReadExt::read_to_end", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"]
12-
- ["futures-util::io::AsyncBufReadExt::read_line", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
13-
- ["futures-util::io::AsyncBufReadExt::read_line", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"]
14-
- ["futures-util::io::AsyncBufReadExt::read_until", "Argument[self]", "Argument[1].Reference", "taint", "manual"]
15-
- ["futures-util::io::AsyncBufReadExt::read_until", "Argument[self].Reference", "Argument[1].Reference", "taint", "manual"]
16-
- ["futures-util::io::AsyncBufReadExt::fill_buf", "Argument[self]", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "taint", "manual"]
17-
- ["futures-util::io::AsyncBufReadExt::lines", "Argument[self]", "ReturnValue", "taint", "manual"]
8+
- ["<_ as futures_util::io::AsyncReadExt>::read", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
9+
- ["<_ as futures_util::io::AsyncReadExt>::read", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"]
10+
- ["<_ as futures_util::io::AsyncReadExt>::read_to_end", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
11+
- ["<_ as futures_util::io::AsyncReadExt>::read_to_end", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"]
12+
- ["<_ as futures_util::io::AsyncBufReadExt>::read_line", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
13+
- ["<_ as futures_util::io::AsyncBufReadExt>::read_line", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"]
14+
- ["<_ as futures_util::io::AsyncBufReadExt>::read_until", "Argument[self]", "Argument[1].Reference", "taint", "manual"]
15+
- ["<_ as futures_util::io::AsyncBufReadExt>::read_until", "Argument[self].Reference", "Argument[1].Reference", "taint", "manual"]
16+
- ["<_ as futures_util::io::AsyncBufReadExt>::fill_buf", "Argument[self]", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "taint", "manual"]
17+
- ["<_ as futures_util::io::AsyncBufReadExt>::lines", "Argument[self]", "ReturnValue", "taint", "manual"]
1818
- ["<alloc::boxed::Box as core::iter::traits::iterator::Iterator>::next", "Argument[self]", "ReturnValue.Future.Field[core::option::Option::Some(0)]", "taint", "manual"]
19-
- ["<futures-util::io::buf_reader::BufReader as futures_io::if_std::AsyncBufRead>::poll_fill_buf", "Argument[self].Reference", "ReturnValue.Field[core::task::poll::Poll::Ready(0)].Field[core::result::Result::Ok(0)]", "taint", "manual"]
19+
- ["<_ as futures_io::if_std::AsyncBufRead>::poll_fill_buf", "Argument[self].Reference", "ReturnValue.Field[core::task::poll::Poll::Ready(0)].Field[core::result::Result::Ok(0)]", "taint", "manual"]

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ 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?;
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`
@@ -61,16 +61,16 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
6161
let mut cx = Context::from_waker(futures::task::noop_waker_ref());
6262
let buffer = pinned.poll_fill_buf(&mut cx);
6363
if let Poll::Ready(Ok(buf)) = buffer {
64-
sink(&buffer); // $ MISSING: hasTaintFlow=url
64+
sink(&buffer); // $ hasTaintFlow=url
6565
sink(buf); // $ MISSING: hasTaintFlow=url
6666
}
6767

6868
// using the `AsyncBufRead` trait (alternative syntax)
6969
let buffer2 = Pin::new(&mut reader2).poll_fill_buf(&mut cx);
7070
match (buffer2) {
7171
Poll::Ready(Ok(buf)) => {
72-
sink(&buffer2); // $ MISSING: hasTaintFlow=url
73-
sink(buf); // $ MISSING: hasTaintFlow=url
72+
sink(&buffer2); // $ hasTaintFlow=url
73+
sink(buf); // $ hasTaintFlow=url
7474
}
7575
_ => {
7676
// ...
@@ -101,7 +101,7 @@ 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?;
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`
@@ -114,7 +114,7 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
114114
sink(&pinned); // $ hasTaintFlow=url
115115
let mut cx = Context::from_waker(futures::task::noop_waker_ref());
116116
let buffer = pinned.poll_fill_buf(&mut cx);
117-
sink(&buffer); // $ MISSING: hasTaintFlow=url
117+
sink(&buffer); // $ hasTaintFlow=url
118118
if let Poll::Ready(Ok(buf)) = buffer {
119119
sink(buf); // $ MISSING: hasTaintFlow=url
120120
}

0 commit comments

Comments
 (0)