cargo mutants: missed mutants in vortex-fuzz
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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:'
- 主要语言
- Rust
- 星标
- 3.2k
- 派生
- 239
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 684
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vortex-data/vortex 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
vortex-data/vortex#12633 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
vortex-data/vortex#12628 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
vortex-data/vortex#12491 ·
维护者通常 1 天内回复
-
Fallible constructor for nested_case_when可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
vortex-data/vortex#11425 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 67/100
vortex-data/vortex#12635 ·
维护者通常 1 天内回复
查看 vortex-data/vortex 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
marklauter/tsong#110 ·
-
docs enhancement
难度 2/5 1-3 小时 新手友好度 78/100
wasm-bindgen/wasm-bindgen#5503 · 1 条评论 ·
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
marketing
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
area: engine bug needs milestone
难度 2/5 1-3 小时 新手友好度 70/100
Mudcrab-Team/mudcrab#1197 · 1 条评论 ·
维护者通常 1 天内回复