cargo mutants: missed mutants in vortex-fuzz
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start by reviewing the listed surviving mutants in fuzz/fuzz_targets/file_io.rs and fuzz/corruption.rs, then run the corresponding cargo mutants commands included in the issue. Add or adjust fuzz tests so the relevant behavior is exercised and these mutants are caught. Done when the affected mutations no longer survive the fuzz test suite.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The nightly run at fdb9507c04e2939724aa39c298653a8ea3fd3b49 found 7 mutants in vortex-fuzz that survive the tests. They are in code that changed during the last day.
Artifacts:
- mutants-0
- mutants-2
- mutants-13
- mutants-1
- mutants-3
- mutants-6
- mutants-10
- mutants-5
- mutants-4
- mutants-11
- mutants-9
- mutants-12
- mutants-15
- mutants-14
fuzz/fuzz_targets/file_io.rs:93:9
replace FileRoundTrip::check -> bool with true
--- fuzz/fuzz_targets/file_io.rs
+++ replace FileRoundTrip::check -> bool with true
@@ -85,106 +85,17 @@
}
Ok(Self::File(u.arbitrary()?))
}
}
impl FileRoundTrip {
/// Writes, reopens, and scans the file. Returns false for unsupported schemas.
fn check(self) -> bool {
- let (array_data, split_at, projection_expr, filter_expr, write_options) = match self {
- Self::File(action) => (
- action.array,
- None,
- action.projection_expr,
- action.filter_expr,
- action.write_settings.write_options(),
- ),
- Self::Variant { array, split_at } => {
- (array, split_at, None, None, SESSION.write_options())
- }
- };
- if has_duplicate_field_names(array_data.dtype()) {
- return false;
- }
-
- let mut ctx = SESSION.create_execution_ctx();
- let expected_array = if filter_expr.is_none() && projection_expr.is_none() {
- array_data.clone()
- } else {
- let bool_mask = array_data
- .clone()
- .apply(&filter_expr.clone().unwrap_or_else(|| lit(true)))
- .vortex_expect("filter expression evaluation should succeed in fuzz test");
- let bool_mask_bool = bool_mask
- .execute::<BoolArray>(&mut ctx)
- .vortex_expect("execute bool");
- let mask = bool_mask_bool
- .to_mask_fill_null_false(&mut ctx)
- .vortex_expect("fill nulls of the filter mask");
- let filtered = array_data
- .filter(mask)
- .vortex_expect("filter operation should succeed in fuzz test");
- filtered
- .apply(&projection_expr.clone().unwrap_or_else(root))
- .vortex_expect("projection expression evaluation should succeed in fuzz test")
- };
-
- let input = if let Some(split) = split_at {
- let first = array_data.slice(0..split).vortex_expect("valid split");
- let second = array_data
- .slice(split..array_data.len())
- .vortex_expect("valid split");
- ChunkedArray::from_iter([first, second]).into_array()
- } else {
- array_data
- };
-
- let mut full_buff = Vec::new();
- let _footer = write_options
- .blocking(&*RUNTIME)
- .write(&mut full_buff, input.to_array_iterator())
- .vortex_expect("file write should succeed in fuzz test");
-
- let file = SESSION
- .open_options()
- .open_buffer(full_buff)
- .vortex_expect("open_buffer should succeed in fuzz test");
- let projection = projection_expr
- .unwrap_or_else(root)
- .bind(file.dtype())
- .and_then(|expr| expr.optimize_recursive())
- .vortex_expect("projection should bind in fuzz test");
- let filter = filter_expr
- .map(|filter| {
- filter
- .bind(file.dtype())
- .and_then(|expr| expr.optimize_recursive())
- })
- .transpose()
- .vortex_expect("filter should bind in fuzz test");
- let mut output = file
- .scan()
- .vortex_expect("scan should succeed in fuzz test")
- .with_projection(projection)
- .with_some_filter(filter)
- .into_array_iter(&*RUNTIME)
- .vortex_expect("into_array_iter should succeed in fuzz test")
- .try_collect::<_, Vec<_>, _>()
- .vortex_expect("collect should succeed in fuzz test");
-
- let output_array = match output.len() {
- 0 => Canonical::empty(expected_array.dtype()).into_array(),
- 1 => output.pop().vortex_expect("one output"),
- _ => ChunkedArray::from_iter(output).into_array(),
- };
-
- assert_arrays_eq!(output_array, expected_array, &mut ctx);
-
- true
+ true /* ~ changed by cargo-mutants ~ */
}
}
fuzz_target!(|fuzz: FileRoundTrip| -> Corpus {
if fuzz.check() {
Corpus::Keep
} else {
Corpus::Reject
cargo mutants -f fuzz/fuzz_targets/file_io.rs -F ':93:9:'
fuzz/corruption.rs:210:5
replace run_prepared_corruption with ()
--- fuzz/corruption.rs
+++ replace run_prepared_corruption with ()
@@ -202,22 +202,17 @@
});
pub fn run_prepared_corruption(data: &[u8], read: ReadCorrupted) {
// This is a hack to unblock fuzzer. Inputs like this, including empty
// data, make fuzzer immediately crash with an OOM which is a genuine bug
// but doesn't help discover other errors. Remove when this is fixed:
// https://github.com/vortex-data/vortex/issues/12173
// https://github.com/vortex-data/vortex/issues/12244
- if data.len() <= size_of::<u16>() {
- return;
- }
- let (selector, seed): (u16, u64) = Unstructured::new(data).arbitrary().unwrap_or_default();
- let (file, targets) = &FILES[usize::from(selector) % FILES.len()];
- read_corruption_sets(file, targets, seed, read);
+ () /* ~ changed by cargo-mutants ~ */
}
fn read_corruption_sets(file: &[u8], targets: &Targets, seed: u64, read: ReadCorrupted) {
report_on_panic(|| {
for (position, corruption) in CURRENT_SET.get().into_iter().flatten() {
eprintln!("corruption {position} {corruption:?}");
}
});
cargo mutants -f fuzz/corruption.rs -F ':210:5:'
fuzz/corruption.rs:210:19
replace <= with > in run_prepared_corruption
--- fuzz/corruption.rs
+++ replace <= with > in run_prepared_corruption
@@ -202,17 +202,17 @@
});
pub fn run_prepared_corruption(data: &[u8], read: ReadCorrupted) {
// This is a hack to unblock fuzzer. Inputs like this, including empty
// data, make fuzzer immediately crash with an OOM which is a genuine bug
// but doesn't help discover other errors. Remove when this is fixed:
// https://github.com/vortex-data/vortex/issues/12173
// https://github.com/vortex-data/vortex/issues/12244
- if data.len() <= size_of::<u16>() {
+ if data.len() > /* ~ changed by cargo-mutants ~ */ size_of::<u16>() {
return;
}
let (selector, seed): (u16, u64) = Unstructured::new(data).arbitrary().unwrap_or_default();
let (file, targets) = &FILES[usize::from(selector) % FILES.len()];
read_corruption_sets(file, targets, seed, read);
}
fn read_corruption_sets(file: &[u8], targets: &Targets, seed: u64, read: ReadCorrupted) {
cargo mutants -f fuzz/corruption.rs -F ':210:19:'
fuzz/corruption.rs:214:56
replace % with / in run_prepared_corruption
--- fuzz/corruption.rs
+++ replace % with / in run_prepared_corruption
@@ -206,17 +206,17 @@
// data, make fuzzer immediately crash with an OOM which is a genuine bug
// but doesn't help discover other errors. Remove when this is fixed:
// https://github.com/vortex-data/vortex/issues/12173
// https://github.com/vortex-data/vortex/issues/12244
if data.len() <= size_of::<u16>() {
return;
}
let (selector, seed): (u16, u64) = Unstructured::new(data).arbitrary().unwrap_or_default();
- let (file, targets) = &FILES[usize::from(selector) % FILES.len()];
+ let (file, targets) = &FILES[usize::from(selector) / /* ~ changed by cargo-mutants ~ */ FILES.len()];
read_corruption_sets(file, targets, seed, read);
}
fn read_corruption_sets(file: &[u8], targets: &Targets, seed: u64, read: ReadCorrupted) {
report_on_panic(|| {
for (position, corruption) in CURRENT_SET.get().into_iter().flatten() {
eprintln!("corruption {position} {corruption:?}");
}
cargo mutants -f fuzz/corruption.rs -F ':214:56:'
fuzz/corruption.rs:214:56
replace % with + in run_prepared_corruption
--- fuzz/corruption.rs
+++ replace % with + in run_prepared_corruption
@@ -206,17 +206,17 @@
// data, make fuzzer immediately crash with an OOM which is a genuine bug
// but doesn't help discover other errors. Remove when this is fixed:
// https://github.com/vortex-data/vortex/issues/12173
// https://github.com/vortex-data/vortex/issues/12244
if data.len() <= size_of::<u16>() {
return;
}
let (selector, seed): (u16, u64) = Unstructured::new(data).arbitrary().unwrap_or_default();
- let (file, targets) = &FILES[usize::from(selector) % FILES.len()];
+ let (file, targets) = &FILES[usize::from(selector) + /* ~ changed by cargo-mutants ~ */ FILES.len()];
read_corruption_sets(file, targets, seed, read);
}
fn read_corruption_sets(file: &[u8], targets: &Targets, seed: u64, read: ReadCorrupted) {
report_on_panic(|| {
for (position, corruption) in CURRENT_SET.get().into_iter().flatten() {
eprintln!("corruption {position} {corruption:?}");
}
cargo mutants -f fuzz/corruption.rs -F ':214:56:'
fuzz/corruption.rs:219:5
replace read_corruption_sets with ()
--- fuzz/corruption.rs
+++ replace read_corruption_sets with ()
@@ -211,44 +211,17 @@
return;
}
let (selector, seed): (u16, u64) = Unstructured::new(data).arbitrary().unwrap_or_default();
let (file, targets) = &FILES[usize::from(selector) % FILES.len()];
read_corruption_sets(file, targets, seed, read);
}
fn read_corruption_sets(file: &[u8], targets: &Targets, seed: u64, read: ReadCorrupted) {
- report_on_panic(|| {
- for (position, corruption) in CURRENT_SET.get().into_iter().flatten() {
- eprintln!("corruption {position} {corruption:?}");
- }
- });
-
- // Technically this approach makes fuzzer mutator useless as any seed
- // change implies completely different corruptions. However, in this
- // fuzzer we don't actually care about composing corruptions. We do care
- // about speed. Seed + rng compared to a seed-only corruption solution
- // finds roughly 3x more errors during same fuzzing time
- let mut rng = Xoshiro256PlusPlus::seed_from_u64(seed);
- let mut ctx = SESSION.create_execution_ctx();
- for _ in 0..CORRUPTION_SETS {
- let mut entropy = [0u8; SET_ENTROPY_BYTES];
- rng.fill(&mut entropy);
- let mut u = Unstructured::new(&entropy);
- let mut corrupted = file.to_vec();
- let mut applied = [None; MAX_CORRUPTIONS];
- let len = u.int_in_range(1..=MAX_CORRUPTIONS).unwrap_or(1);
- for slot in applied.iter_mut().take(len) {
- let corruption = u.arbitrary().ok();
- *slot = corruption.and_then(|corruption| targets.apply(&mut corrupted, corruption));
- }
- CURRENT_SET.set(applied);
- read(&mut ctx, corrupted).ok();
- }
- CURRENT_SET.set([None; MAX_CORRUPTIONS]);
+ () /* ~ changed by cargo-mutants ~ */
}
fn postscript(file: &[u8]) -> Option<fb::Postscript<'_>> {
let eof_start = file.len() - EOF_SIZE;
let start = eof_start + VERSION_BYTES;
let end = start + POSTSCRIPT_LEN_BYTES;
let len_bytes: [u8; POSTSCRIPT_LEN_BYTES] = file.get(start..end)?.try_into().ok()?;
let postscript_len = usize::from(u16::from_le_bytes(len_bytes));
cargo mutants -f fuzz/corruption.rs -F ':219:5:'
fuzz/fuzz_targets/file_io.rs:93:9
replace FileRoundTrip::check -> bool with false
--- fuzz/fuzz_targets/file_io.rs
+++ replace FileRoundTrip::check -> bool with false
@@ -85,106 +85,17 @@
}
Ok(Self::File(u.arbitrary()?))
}
}
impl FileRoundTrip {
/// Writes, reopens, and scans the file. Returns false for unsupported schemas.
fn check(self) -> bool {
- let (array_data, split_at, projection_expr, filter_expr, write_options) = match self {
- Self::File(action) => (
- action.array,
- None,
- action.projection_expr,
- action.filter_expr,
- action.write_settings.write_options(),
- ),
- Self::Variant { array, split_at } => {
- (array, split_at, None, None, SESSION.write_options())
- }
- };
- if has_duplicate_field_names(array_data.dtype()) {
- return false;
- }
-
- let mut ctx = SESSION.create_execution_ctx();
- let expected_array = if filter_expr.is_none() && projection_expr.is_none() {
- array_data.clone()
- } else {
- let bool_mask = array_data
- .clone()
- .apply(&filter_expr.clone().unwrap_or_else(|| lit(true)))
- .vortex_expect("filter expression evaluation should succeed in fuzz test");
- let bool_mask_bool = bool_mask
- .execute::<BoolArray>(&mut ctx)
- .vortex_expect("execute bool");
- let mask = bool_mask_bool
- .to_mask_fill_null_false(&mut ctx)
- .vortex_expect("fill nulls of the filter mask");
- let filtered = array_data
- .filter(mask)
- .vortex_expect("filter operation should succeed in fuzz test");
- filtered
- .apply(&projection_expr.clone().unwrap_or_else(root))
- .vortex_expect("projection expression evaluation should succeed in fuzz test")
- };
-
- let input = if let Some(split) = split_at {
- let first = array_data.slice(0..split).vortex_expect("valid split");
- let second = array_data
- .slice(split..array_data.len())
- .vortex_expect("valid split");
- ChunkedArray::from_iter([first, second]).into_array()
- } else {
- array_data
- };
-
- let mut full_buff = Vec::new();
- let _footer = write_options
- .blocking(&*RUNTIME)
- .write(&mut full_buff, input.to_array_iterator())
- .vortex_expect("file write should succeed in fuzz test");
-
- let file = SESSION
- .open_options()
- .open_buffer(full_buff)
- .vortex_expect("open_buffer should succeed in fuzz test");
- let projection = projection_expr
- .unwrap_or_else(root)
- .bind(file.dtype())
- .and_then(|expr| expr.optimize_recursive())
- .vortex_expect("projection should bind in fuzz test");
- let filter = filter_expr
- .map(|filter| {
- filter
- .bind(file.dtype())
- .and_then(|expr| expr.optimize_recursive())
- })
- .transpose()
- .vortex_expect("filter should bind in fuzz test");
- let mut output = file
- .scan()
- .vortex_expect("scan should succeed in fuzz test")
- .with_projection(projection)
- .with_some_filter(filter)
- .into_array_iter(&*RUNTIME)
- .vortex_expect("into_array_iter should succeed in fuzz test")
- .try_collect::<_, Vec<_>, _>()
- .vortex_expect("collect should succeed in fuzz test");
-
- let output_array = match output.len() {
- 0 => Canonical::empty(expected_array.dtype()).into_array(),
- 1 => output.pop().vortex_expect("one output"),
- _ => ChunkedArray::from_iter(output).into_array(),
- };
-
- assert_arrays_eq!(output_array, expected_array, &mut ctx);
-
- true
+ false /* ~ changed by cargo-mutants ~ */
}
}
fuzz_target!(|fuzz: FileRoundTrip| -> Corpus {
if fuzz.check() {
Corpus::Keep
} else {
Corpus::Reject
cargo mutants -f fuzz/fuzz_targets/file_io.rs -F ':93:9:'
- Lingua principale
- Rust
- Stelle
- 3.2k
- Fork
- 239
- Merge medio
- 1g 4h
- PR unite (30g)
- 684
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vortex-data/vortex
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
vortex-data/vortex#12633 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
vortex-data/vortex#12628 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
vortex-data/vortex#12491 ·
I maintainer di solito rispondono entro 1 giorno
-
Fallible constructor for nested_case_whenForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
vortex-data/vortex#11425 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
vortex-data/vortex#12635 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vortex-data/vortex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
marklauter/tsong#110 ·
-
docs enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wasm-bindgen/wasm-bindgen#5503 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
area: engine bug needs milestone
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Mudcrab-Team/mudcrab#1197 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno