diff --git a/rust/src/sans_io/read.rs b/rust/src/sans_io/read.rs index 5d38293f73..dd2ae43bd9 100644 --- a/rust/src/sans_io/read.rs +++ b/rust/src/sans_io/read.rs @@ -1101,4 +1101,25 @@ mod tests { } Ok(()) } + + #[test] + fn test_decompression_does_not_fail() { + let mut f = std::fs::File::open("tests/data/break_zstd_decompression.mcap") + .expect("failed to open file"); + let blocksize: usize = 1024; + let mut reader = LinearReader::new(); + while let Some(action) = reader.next_action() { + match action.expect("failed to get next action") { + ReadAction::GetRecord { data: _, opcode } => { + print!("{},", opcode); + } + ReadAction::NeedMore(_) => { + let read = f + .read(reader.insert(blocksize)) + .expect("failed to read from file"); + reader.set_written(read); + } + } + } + } } diff --git a/rust/tests/data/break_zstd_decompression.mcap b/rust/tests/data/break_zstd_decompression.mcap new file mode 100644 index 0000000000..6da2c82b62 --- /dev/null +++ b/rust/tests/data/break_zstd_decompression.mcap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebae730b155399c2f77a7afcabf539ba92f79618386ca2c0e59e8254e02b1a95 +size 24478233