File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed 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 base64;
4
5
5
6
use base64:: engine:: fast_portable;
6
7
7
8
fuzz_target ! ( |data: & [ u8 ] | {
8
- let config = fast_portable:: FastPortableConfig :: new( ) . with_encode_padding( false ) ;
9
+ let config = fast_portable:: FastPortableConfig :: new( )
10
+ . with_encode_padding( false )
11
+ . with_decode_padding_mode( fast_portable:: DecodePaddingMode :: RequireNone ) ;
9
12
let engine = fast_portable:: FastPortable :: from( & base64:: alphabet:: STANDARD , config) ;
10
13
11
14
let encoded = base64:: encode_engine( & data, & engine) ;
Original file line number Diff line number Diff line change @@ -22,9 +22,16 @@ pub fn random_engine(data: &[u8]) -> fast_portable::FastPortable {
22
22
alphabet:: STANDARD
23
23
} ;
24
24
25
+ let encode_padding = rng. gen ( ) ;
26
+ let decode_padding = if encode_padding {
27
+ fast_portable:: DecodePaddingMode :: RequireCanonical
28
+ } else {
29
+ fast_portable:: DecodePaddingMode :: RequireNone
30
+ } ;
25
31
let config = fast_portable:: FastPortableConfig :: new ( )
26
- . with_encode_padding ( rng. gen ( ) )
27
- . with_decode_allow_trailing_bits ( rng. gen ( ) ) ;
32
+ . with_encode_padding ( encode_padding)
33
+ . with_decode_allow_trailing_bits ( rng. gen ( ) )
34
+ . with_decode_padding_mode ( decode_padding) ;
28
35
29
36
fast_portable:: FastPortable :: from ( & alphabet, config)
30
37
}
You can’t perform that action at this time.
0 commit comments