File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,23 @@ pub fn test_input_wrap(data: *const u8, size: usize) -> i32 {
9
9
:: std:: panic:: catch_unwind ( || unsafe {
10
10
let data_slice = :: std:: slice:: from_raw_parts ( data, size) ;
11
11
rust_fuzzer_test_input ( data_slice) ;
12
- } ) . err ( ) . map ( |_| :: std:: process:: abort ( ) ) ;
12
+ } )
13
+ . err ( ) . map ( |_|
14
+ // hopefully the custom panic hook will be called before and abort the
15
+ // process before the stack frames are unwinded.
16
+ :: std:: process:: abort ( )
17
+ ) ;
18
+ 0
19
+ }
20
+
21
+ #[ export_name="LLVMFuzzerInitialize" ]
22
+ pub fn initialize ( _argc : * const isize , _argv : * const * const * const u8 ) -> isize {
23
+ // Registers a panic hook that aborts the process before unwinding.
24
+ // It is useful to abort before unwinding so that the fuzzer will then be
25
+ // able to analyse the process stack frames to tell different bugs appart.
26
+ :: std:: panic:: set_hook ( Box :: new ( |_| {
27
+ :: std:: process:: abort ( ) ;
28
+ } ) ) ;
13
29
0
14
30
}
15
31
You can’t perform that action at this time.
0 commit comments