Skip to content

Commit 2bc042b

Browse files
TanishGudiseclaude
andcommitted
test(fuzz): keep only garbage-null-code dictionaries in this change
The string-dictionary and CUDA-preset string generators in the GPU fuzz target aren't part of the bounds fix, so they move to a separate change. The fuzz target keeps the dictionaries with arbitrary codes under null positions, which exercise the bounds check, and the regression test now describes the dictionary the fuzzer found without quoting input bytes that no longer reproduce it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Tanish Gudise <[email protected]>
1 parent 25b4f44 commit 2bc042b

2 files changed

Lines changed: 6 additions & 38 deletions

File tree

‎fuzz/src/gpu/mod.rs‎

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ use vortex_array::dtype::DType;
2323
use vortex_array::dtype::Nullability;
2424
use vortex_array::dtype::PType;
2525
use vortex_array::validity::Validity;
26-
use vortex_btrblocks::BtrBlocksCompressorBuilder;
2726
use vortex_buffer::Buffer;
28-
use vortex_error::VortexExpect;
2927
use vortex_error::vortex_err;
3028

3129
use crate::SESSION;
@@ -36,24 +34,18 @@ use crate::error::VortexFuzzResult;
3634
/// Which GPU-supported encoding to generate.
3735
#[derive(Debug, Clone, Copy)]
3836
pub enum GpuEncodingKind {
39-
/// Dictionary encoding with primitive values.
37+
/// Dictionary encoding with GPU take support.
4038
Dict,
41-
/// Dictionary encoding with UTF-8 or binary values.
42-
StringDict,
4339
/// Dictionary whose nullable codes hold arbitrary values, possibly outside the dictionary,
4440
/// under null positions.
4541
DictGarbageNullCodes,
46-
/// UTF-8 or binary arrays compressed with the CUDA-compatible BtrBlocks preset.
47-
CudaCompressedStrings,
4842
}
4943

5044
impl<'a> Arbitrary<'a> for GpuEncodingKind {
5145
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
52-
match u.int_in_range(0..=3)? {
46+
match u.int_in_range(0..=1)? {
5347
0 => Ok(GpuEncodingKind::Dict),
54-
1 => Ok(GpuEncodingKind::StringDict),
55-
2 => Ok(GpuEncodingKind::DictGarbageNullCodes),
56-
3 => Ok(GpuEncodingKind::CudaCompressedStrings),
48+
1 => Ok(GpuEncodingKind::DictGarbageNullCodes),
5749
_ => unreachable!(),
5850
}
5951
}
@@ -77,31 +69,7 @@ impl<'a> Arbitrary<'a> for FuzzCompressGpu {
7769
.0
7870
.into_array()
7971
}
80-
GpuEncodingKind::StringDict => {
81-
let dtype = arbitrary_gpu_string_dtype(u)?;
82-
ArbitraryDictArray::with_dtype(u, &dtype, None)?
83-
.0
84-
.into_array()
85-
}
8672
GpuEncodingKind::DictGarbageNullCodes => arbitrary_dict_with_garbage_null_codes(u)?,
87-
GpuEncodingKind::CudaCompressedStrings => {
88-
// Draw rows from a small pool so the compressor sees repeated values and can
89-
// choose a string dictionary as well as FSST, OnPair or constants.
90-
let dtype = arbitrary_gpu_string_dtype(u)?;
91-
let len = u.int_in_range(0..=4096)?;
92-
let rows = ArbitraryDictArray::with_dtype(u, &dtype, Some(len))?.0;
93-
let mut ctx = SESSION.create_execution_ctx();
94-
let canonical = rows
95-
.into_array()
96-
.execute::<Canonical>(&mut ctx)
97-
.vortex_expect("canonicalize should succeed in fuzz test")
98-
.into_array();
99-
BtrBlocksCompressorBuilder::from_session(&SESSION)
100-
.only_cuda_compatible()
101-
.build()
102-
.compress(&canonical, &mut ctx)
103-
.vortex_expect("BtrBlocksCompressor compress should succeed in fuzz test")
104-
}
10573
};
10674

10775
Ok(FuzzCompressGpu { array })

‎vortex-cuda/src/kernel/arrays/dict.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,9 +1257,9 @@ mod tests {
12571257
assert_gpu_matches(codes, sane, values.into_array()).await
12581258
}
12591259

1260-
/// The shape the `compress_gpu` fuzzer found (input `f6 88 10 00 00 00 00 02 41 f8 02 26 2d 0a ec
1261-
/// fe`): a one-value dictionary whose null code is 3,960,089,894. An unchecked gather reads about
1262-
/// 4 GB past the dictionary and fails with `CUDA_ERROR_ILLEGAL_ADDRESS`.
1260+
/// The shape the `compress_gpu` fuzzer found: a one-value dictionary whose null code is
1261+
/// 3,960,089,894. An unchecked gather reads about 4 GB past the dictionary and fails with
1262+
/// `CUDA_ERROR_ILLEGAL_ADDRESS`.
12631263
#[crate::test]
12641264
async fn test_cuda_dict_fuzz_garbage_null_code() -> VortexResult<()> {
12651265
let values = PrimitiveArray::new(Buffer::from(vec![0u8]), NonNullable);

0 commit comments

Comments
 (0)