clickhouse_driver
clickhouse_driver copied to clipboard
Ensured that original buffer is initialized in test_decompression
We've been prototyping a version of Miri that can execute foreign functions. It found a bug in the test case test_decompression.
THe buffer orig is only partially initialized
let mut orig: Vec<u8> = Vec::with_capacity(*sz);
unsafe {
orig.set_len(*sz);
{
//it's sort of randomized data
orig[0] = 1;
orig[*sz / 4] = 4;
orig[*sz / 2] = 7;
orig[*sz * 2 / 3] = 10;
orig[*sz - 1] = 1;
}
Later, its contents is compared against another buffer using assert_eq!
assert_eq!(&orig[0..*sz], &buf[0..cz]);
This uses the intrinsic compare_bytes, which requires both slices to be fully initialized.
Commit b45549d fixes this by zero-initializing the buffer orig using orig.fill(0).