File tree 5 files changed +30
-6
lines changed
5 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -27,4 +27,8 @@ path = "fuzz_targets/iterate.rs"
27
27
28
28
[[bin ]]
29
29
name = " raw_deserialize"
30
- path = " fuzz_targets/raw_deserialize.rs"
30
+ path = " fuzz_targets/raw_deserialize.rs"
31
+
32
+ [[bin ]]
33
+ name = " raw_deserialize_utf8_lossy"
34
+ path = " fuzz_targets/raw_deserialize_utf8_lossy.rs"
Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
- #[ macro_use] extern crate libfuzzer_sys;
2
+ #[ macro_use]
3
+ extern crate libfuzzer_sys;
3
4
extern crate bson;
4
5
5
6
use bson:: Document ;
6
7
use std:: io:: Cursor ;
7
8
8
9
fuzz_target ! ( |buf: & [ u8 ] | {
9
- let _ = Document :: from_reader( & mut Cursor :: new( & buf[ ..] ) ) ;
10
+ if let Ok ( doc) = Document :: from_reader( & mut Cursor :: new( & buf[ ..] ) ) {
11
+ let mut vec = Vec :: with_capacity( buf. len( ) ) ;
12
+ let _ = doc. to_writer( & mut vec) ;
13
+ }
10
14
} ) ;
Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
- #[ macro_use] extern crate libfuzzer_sys;
2
+ #[ macro_use]
3
+ extern crate libfuzzer_sys;
3
4
extern crate bson;
4
5
use bson:: RawDocument ;
5
6
Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
- #[ macro_use] extern crate libfuzzer_sys;
2
+ #[ macro_use]
3
+ extern crate libfuzzer_sys;
3
4
extern crate bson;
4
5
use bson:: Document ;
5
6
6
7
fuzz_target ! ( |buf: & [ u8 ] | {
7
- let _ = bson:: from_slice:: <Document >( buf) ;
8
+ if let Ok ( doc) = bson:: from_slice:: <Document >( buf) {
9
+ let mut vec = Vec :: with_capacity( buf. len( ) ) ;
10
+ let _ = doc. to_writer( & mut vec) ;
11
+ }
8
12
} ) ;
Original file line number Diff line number Diff line change
1
+ #![ no_main]
2
+ #[ macro_use] extern crate libfuzzer_sys;
3
+ extern crate bson;
4
+ use bson:: Document ;
5
+
6
+ fuzz_target ! ( |buf: & [ u8 ] | {
7
+ if let Ok ( doc) = bson:: from_slice_utf8_lossy:: <Document >( buf) {
8
+ let mut vec = Vec :: with_capacity( buf. len( ) ) ;
9
+ let _ = doc. to_writer( & mut vec) ;
10
+ }
11
+ } ) ;
You can’t perform that action at this time.
0 commit comments