Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memcpy-param-overlap in LZ4.c #14

Open
riking opened this issue Feb 28, 2024 · 0 comments
Open

memcpy-param-overlap in LZ4.c #14

riking opened this issue Feb 28, 2024 · 0 comments

Comments

@riking
Copy link

riking commented Feb 28, 2024

https://asan.saethlin.dev/ub?crate=clickhouse-driver-lz4&version=0.1.0

test test::test_compression ... =================================================================
==25925==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x7fadad8511f6,0x7fadad8efd06) and [0x7fadad86081f, 0x7fadad8ff32f) overlap
    #0 0x559c6e9cd688 in memcpy /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115:5
    #1 0x559c6e9ff406 in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:10
    #2 0x559c6e9ff406 in LZ4_compress_generic /build/liblz4/lib/lz4.c:1169:9
    #3 0x559c6e9ff406 in LZ4_compress_fast_extState /build/liblz4/lib/lz4.c:1201:20
    #4 0x559c6ea01062 in LZ4_compress_fast /build/liblz4/lib/lz4.c:1262:14
    #5 0x559c6e9fc039 in clickhouse_driver_lz4::test::test_compression::h37e23394f401ffa6 /build/src/lib.rs:170:28
    #6 0x559c6e9fb212 in clickhouse_driver_lz4::test::test_compression::_$u7b$$u7b$closure$u7d$$u7d$::hc457532524c3911c /build/src/lib.rs:136:26
0x7fadad8511f6 is located 2550 bytes inside of 715567-byte region [0x7fadad850800,0x7fadad8ff32f)
0x7fadad86081f is located 65567 bytes inside of 715567-byte region [0x7fadad850800,0x7fadad8ff32f)
allocated by thread T1 here:
    #0 0x559c6e9ce73e in malloc /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
    #1 0x559c6efb9fde in std::sys::unix::alloc::_$LT$impl$u20$core..alloc..global..GlobalAlloc$u20$for$u20$std..alloc..System$GT$::alloc::hbfc48fea06eea223 /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/alloc.rs:14:13
    #2 0x559c6ef3dbba in __rdl_alloc /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/alloc.rs:394:13
    #3 0x559c6f306da2 in alloc::alloc::Global::alloc_impl::h03a6711467ad517c /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:181:73
    #4 0x559c6f307b67 in _$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$::allocate::h2f1ab19eedcd5ee6 /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:241:9
    #5 0x559c6f300fc3 in alloc::raw_vec::RawVec$LT$T$C$A$GT$::with_capacity_in::h6519cdd055af899c /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:130:9
    #6 0x559c6e9fb212 in clickhouse_driver_lz4::test::test_compression::_$u7b$$u7b$closure$u7d$$u7d$::hc457532524c3911c /build/src/lib.rs:136:26
SUMMARY: AddressSanitizer: memcpy-param-overlap /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115:5 in memcpy
==25925==ABORTING

Check for an updated version of LZ4 that uses memmove when the parameters are overlapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant