-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path0089-fil-ocl.rs
63 lines (51 loc) · 1.44 KB
/
0089-fil-ocl.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*!
```rudra-poc
[target]
crate = "fil-ocl"
version = "0.19.4"
[test]
analyzers = ["UnsafeDataflow"]
bug_classes = ["PanicSafety"]
[report]
issue_url = "https://github.com/cogciprocate/ocl/issues/194"
issue_date = 2021-01-04
rustsec_url = "https://github.com/RustSec/advisory-db/pull/587"
rustsec_id = "RUSTSEC-2021-0011"
[[bugs]]
analyzer = "UnsafeDataflow"
bug_class = "PanicSafety"
rudra_report_locations = ["src/standard/event.rs:1038:13: 1049:14"]
[[bugs]]
analyzer = "Manual"
guide = "UnsafeDataflow"
bug_class = "PanicSafety"
rudra_report_locations = []
```
!*/
#![forbid(unsafe_code)]
// `fil_ocl` crate requires OpenCL to be installed in order to build & run.
// CI will probably fail to build & run this poc.
// Thus I changed the file extension of this PoC so that our CI will not build this example.
use fil_ocl::{Event, EventList};
use std::convert::Into;
struct Foo(Option<i32>);
impl Into<Event> for Foo {
fn into(self) -> Event {
/*
According to the docs, `Into<T>` implementations shouldn't panic.
However rustc doesn't check whether panics can happen in the Into implementation,
so it's possible for a user-provided `into()` to panic..
*/
println!("LOUSY PANIC : {}", self.0.unwrap());
Event::empty()
}
}
impl Drop for Foo {
fn drop(&mut self) {
println!("I'm dropping");
}
}
fn main() {
let eventlist: EventList = [Foo(None)].into();
dbg!(eventlist);
}