cargo mutants: missed mutants in vortex-fuzz
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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:'
- Vorherrschende Sprache
- Rust
- Sterne
- 3.2k
- Forks
- 239
- Ø Merge
- 1 T. 4 Std.
- Gemergte PRs (30 T.)
- 684
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus vortex-data/vortex
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
vortex-data/vortex#12633 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
vortex-data/vortex#12628 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
vortex-data/vortex#12491 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Fallible constructor for nested_case_whenEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
vortex-data/vortex#11425 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 67/100
vortex-data/vortex#12635 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in vortex-data/vortex
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
valkey-io/valkey-glide#7975 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
marklauter/tsong#110 ·
-
docs enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
wasm-bindgen/wasm-bindgen#5503 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag