Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
0

Configure Feed

Select the types of activity you want to include in your feed.

more minimal fuzz repro

+7 -17
+7 -17
ufos/fuzz/fuzz_targets/cardinality_estimator.rs
··· 1 1 #![no_main] 2 2 3 - use jetstream::exports::Did; 4 - use bincode::config::{Configuration, BigEndian, Fixint, Limit, standard}; 3 + use bincode::config::{Configuration, LittleEndian, Varint, Limit, standard}; 5 4 use bincode::serde::decode_from_slice; 6 5 use cardinality_estimator::CardinalityEstimator; 7 6 use libfuzzer_sys::fuzz_target; 8 7 9 - #[cfg(not(target_env = "msvc"))] 10 - use tikv_jemallocator::Jemalloc; 11 - 12 - #[cfg(not(target_env = "msvc"))] 13 - #[global_allocator] 14 - static GLOBAL: Jemalloc = Jemalloc; 15 - 16 - type C = Configuration<BigEndian, Fixint, Limit<1048576>>; 17 - static BINCODE_CONF: C = 18 - standard() 19 - .with_big_endian() 20 - .with_fixed_int_encoding() 21 - .with_limit::<1048576>(); 8 + type C = Configuration<LittleEndian, Varint, Limit<1048576>>; 9 + static BINCODE_CONF: C = standard().with_limit::<1048576>(); 22 10 23 11 fuzz_target!(|data: &[u8]| { 24 - if let Ok((estimator, _n)) = decode_from_slice::<CardinalityEstimator<Did>, C>( 12 + if let Ok((mut estimator, _n)) = decode_from_slice::<CardinalityEstimator<String>, C>( 25 13 data, 26 14 BINCODE_CONF, 27 15 ) { 28 - estimator.estimate(); 16 + // crash happens *much* faster if we just do kinda anything with the estimator 17 + estimator.insert(&"asdf".to_string()); 18 + assert!(estimator.estimate() > 0); 29 19 } 30 20 });