timescaledb-toolkit
timescaledb-toolkit copied to clipboard
Some flat_serialize tests fail under Miri
Two tests in our flat_serialize
crate fail when run under Miri, a Rust interpreter that can detect some undefined behavior:
$ cargo miri test --target x86_64-unknown-linux-gnu
...
failures:
---- tests::many_enum stdout ----
thread 'tests::many_enum' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidTag(0)', crates/flat_serialize/flat_serialize/src/lib.rs:1317:83
---- tests::nested_slice stdout ----
thread 'tests::nested_slice' panicked at 'called `Result::unwrap()` on an `Err` value: NotEnoughBytes(38)', crates/flat_serialize/flat_serialize/src/lib.rs:1065:51
failures:
tests::many_enum
tests::nested_slice
test result: FAILED. 18 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
I don't know why this only happens with Miri, and not when run normally. It seems flat_serialize
is doing memory reads in a way that is potentially UB.