File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ crossbeam-queue = "0.1.2"
24
24
rand = " 0.6"
25
25
rand_xorshift = " 0.1"
26
26
27
+ [target .'cfg(unix)' .dev-dependencies ]
28
+ libc = " 0.2"
29
+
27
30
[[test ]]
28
31
name = " stack_overflow_crash"
29
32
path = " tests/stack_overflow_crash.rs"
Original file line number Diff line number Diff line change
1
+ #[ cfg( unix) ]
2
+ extern crate libc;
1
3
extern crate rayon_core;
2
4
3
5
use rayon_core:: ThreadPoolBuilder ;
@@ -15,6 +17,19 @@ fn force_stack_overflow(depth: u32) {
15
17
}
16
18
}
17
19
20
+ #[ cfg( unix) ]
21
+ fn disable_core ( ) {
22
+ unsafe {
23
+ libc:: setrlimit (
24
+ libc:: RLIMIT_CORE ,
25
+ & libc:: rlimit {
26
+ rlim_cur : 0 ,
27
+ rlim_max : 0 ,
28
+ } ,
29
+ ) ;
30
+ }
31
+ }
32
+
18
33
#[ cfg( unix) ]
19
34
fn overflow_code ( ) -> Option < i32 > {
20
35
None
@@ -63,6 +78,8 @@ fn main() {
63
78
. build ( )
64
79
. unwrap ( ) ;
65
80
pool. install ( || {
81
+ #[ cfg( unix) ]
82
+ disable_core ( ) ;
66
83
force_stack_overflow ( 32 ) ;
67
84
} ) ;
68
85
}
You can’t perform that action at this time.
0 commit comments