mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fix MSAN test
This commit is contained in:
parent
c08b41b611
commit
ff82784b91
1
contrib/BLAKE3/Cargo.lock
generated
1
contrib/BLAKE3/Cargo.lock
generated
@ -53,6 +53,7 @@ dependencies = [
|
||||
"blake3 1.2.0",
|
||||
"cbindgen",
|
||||
"cc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -8,6 +8,7 @@ build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
blake3 = "1.2.*"
|
||||
libc = "0.2.*"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
|
@ -1,6 +1,8 @@
|
||||
use blake3::{Hasher, OUT_LEN};
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::os::raw::c_char;
|
||||
use libc;
|
||||
use std::mem;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn blake3_apply_shim(
|
||||
@ -25,12 +27,13 @@ pub unsafe extern "C" fn blake3_apply_shim(
|
||||
pub unsafe extern "C" fn blake3_apply_shim_msan_compat(
|
||||
mut begin: *const c_char,
|
||||
size: u32,
|
||||
out_char_data: *mut u8,
|
||||
mut out_char_data: *mut u8,
|
||||
) -> *mut c_char {
|
||||
if begin.is_null() {
|
||||
let err_str = CString::new("input was a null pointer").unwrap();
|
||||
return err_str.into_raw();
|
||||
}
|
||||
libc::memset(out_char_data as *mut libc::c_void, 0, mem::size_of::<u8>());
|
||||
let mut hasher = Hasher::new();
|
||||
let mut vec = Vec::<u8>::new();
|
||||
for _ in 0..size {
|
||||
|
@ -603,6 +603,7 @@ struct ImplBLAKE3
|
||||
{
|
||||
#if defined(MEMORY_SANITIZER)
|
||||
auto err_msg = blake3_apply_shim_msan_compat(begin, size, out_char_data);
|
||||
__msan_unpoison(out_char_data, length);
|
||||
#else
|
||||
auto err_msg = blake3_apply_shim(begin, size, out_char_data);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user