ClickHouse/contrib
Azat Khuzhin efb6433a39 Fix container-overflow in replxx during incremental search (Ctrl-R)
ASAN report:

    =================================================================
    ==7686==ERROR: AddressSanitizer: container-overflow on address 0x6200000bf080 at pc 0x00002a787e79 bp 0x7fffffffa2f0 sp 0x7fffffffa2e8
    READ of size 4 at 0x6200000bf080 thread T0
        0 0x2a787e78 in replxx::calculate_displayed_length(char32_t const*, int) obj-x86_64-linux-gnu/../contrib/replxx/src/util.cxx:66:15
        1 0x2a75786c in replxx::Replxx::ReplxxImpl::dynamicRefresh(replxx::Prompt&, char32_t*, int, int) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:2201:3
        2 0x2a7453f0 in replxx::Replxx::ReplxxImpl::incremental_history_search(char32_t) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:2008:3
        3 0x2a73eecc in replxx::Replxx::ReplxxImpl::action(unsigned long long, replxx::Replxx::ACTION_RESULT (replxx::Replxx::ReplxxImpl::* const&)(char32_t), char32_t) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:1246:29
        4 0x2a73eecc in replxx::Replxx::ReplxxImpl::invoke(replxx::Replxx::ACTION, char32_t) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:318:70
        5 0x2a74ed29 in std::__1::__function::__policy_func<replxx::Replxx::ACTION_RESULT (char32_t)>::operator()(char32_t&&) const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
        6 0x2a74ed29 in std::__1::function<replxx::Replxx::ACTION_RESULT (char32_t)>::operator()(char32_t) const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
        7 0x2a74ed29 in replxx::Replxx::ReplxxImpl::get_input_line() obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx🔢11
        8 0x2a74dd3c in replxx::Replxx::ReplxxImpl::input(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:580:8
        9 0x2a2a4075 in ReplxxLineReader::readOneLine(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../base/common/ReplxxLineReader.cpp:112:29
        10 0x2a29b499 in LineReader::readLine(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../base/common/LineReader.cpp:81:26
        11 0xb580f02 in DB::Client::mainImpl() obj-x86_64-linux-gnu/../programs/client/Client.cpp:665:33
        12 0xb575825 in DB::Client::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) obj-x86_64-linux-gnu/../programs/client/Client.cpp:300:20
        13 0x2a3aff25 in Poco::Util::Application::run() obj-x86_64-linux-gnu/../contrib/poco/Util/src/Application.cpp:334:8
        14 0xb54c810 in mainEntryClickHouseClient(int, char**) obj-x86_64-linux-gnu/../programs/client/Client.cpp:2702:23
        15 0xb326d8a in main obj-x86_64-linux-gnu/../programs/main.cpp:360:12
        16 0x7ffff7dcbb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
        17 0xb2794ad in _start (/src/ch/tmp/upstream/clickhouse-asan+0xb2794ad)

    0x6200000bf080 is located 0 bytes inside of 3672-byte region [0x6200000bf080,0x6200000bfed8)
    allocated by thread T0 here:
        0 0xb3231dd in operator new(unsigned long) (/src/ch/tmp/upstream/clickhouse-asan+0xb3231dd)
        1 0x2a75fb15 in void* std::__1::__libcpp_operator_new<unsigned long>(unsigned long) obj-x86_64-linux-gnu/../contrib/libcxx/include/new:235:10
        2 0x2a75fb15 in std::__1::__libcpp_allocate(unsigned long, unsigned long) obj-x86_64-linux-gnu/../contrib/libcxx/include/new:261:10
        3 0x2a75fb15 in std::__1::allocator<char32_t>::allocate(unsigned long) obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:840:38
        4 0x2a75fb15 in std::__1::allocator_traits<std::__1::allocator<char32_t> >::allocate(std::__1::allocator<char32_t>&, unsigned long) obj-x86_64-linux-gnu/../contrib/libcxx/include/__memory/allocator_traits.h:468:21
        5 0x2a75fb15 in std::__1::vector<char32_t, std::__1::allocator<char32_t> >::__vallocate(unsigned long) obj-x86_64-linux-gnu/../contrib/libcxx/include/vector:993:37
        6 0x2a75fb15 in std::__1::enable_if<(__is_cpp17_forward_iterator<char32_t*>::value) && (is_constructible<char32_t, std::__1::iterator_traits<char32_t*>::reference>::value), void>::type std::__1::vector<char32_t, std::__1::allocator<char32_t> >::assign<char32_t*>(char32_t*, char32_t*) obj-x86_64-linux-gnu/../contrib/libcxx/include/vector:1460:9
        7 0x2a745242 in std::__1::vector<char32_t, std::__1::allocator<char32_t> >::operator=(std::__1::vector<char32_t, std::__1::allocator<char32_t> > const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/vector:1405:9
        8 0x2a745242 in replxx::UnicodeString::assign(replxx::UnicodeString const&) obj-x86_64-linux-gnu/../contrib/replxx/src/unicodestring.hxx:83:9
        9 0x2a745242 in replxx::Replxx::ReplxxImpl::incremental_history_search(char32_t) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:1993:24
        10 0x2a73eecc in replxx::Replxx::ReplxxImpl::action(unsigned long long, replxx::Replxx::ACTION_RESULT (replxx::Replxx::ReplxxImpl::* const&)(char32_t), char32_t) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:1246:29
        11 0x2a73eecc in replxx::Replxx::ReplxxImpl::invoke(replxx::Replxx::ACTION, char32_t) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:318:70
        12 0x2a74ed29 in std::__1::__function::__policy_func<replxx::Replxx::ACTION_RESULT (char32_t)>::operator()(char32_t&&) const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
        13 0x2a74ed29 in std::__1::function<replxx::Replxx::ACTION_RESULT (char32_t)>::operator()(char32_t) const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
        14 0x2a74ed29 in replxx::Replxx::ReplxxImpl::get_input_line() obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx🔢11
        15 0x2a74dd3c in replxx::Replxx::ReplxxImpl::input(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/replxx/src/replxx_impl.cxx:580:8
        16 0x2a2a4075 in ReplxxLineReader::readOneLine(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../base/common/ReplxxLineReader.cpp:112:29
        17 0x2a29b499 in LineReader::readLine(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../base/common/LineReader.cpp:81:26
        18 0xb580f02 in DB::Client::mainImpl() obj-x86_64-linux-gnu/../programs/client/Client.cpp:665:33
        19 0xb575825 in DB::Client::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) obj-x86_64-linux-gnu/../programs/client/Client.cpp:300:20
        20 0x2a3aff25 in Poco::Util::Application::run() obj-x86_64-linux-gnu/../contrib/poco/Util/src/Application.cpp:334:8
        21 0xb54c810 in mainEntryClickHouseClient(int, char**) obj-x86_64-linux-gnu/../programs/client/Client.cpp:2702:23
        22 0xb326d8a in main obj-x86_64-linux-gnu/../programs/main.cpp:360:12
        23 0x7ffff7dcbb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

    HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_container_overflow=0.
    If you suspect a false positive see also: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow.
    SUMMARY: AddressSanitizer: container-overflow obj-x86_64-linux-gnu/../contrib/replxx/src/util.cxx:66:15 in replxx::calculate_displayed_length(char32_t const*, int)
    Shadow bytes around the buggy address:
      0x0c408000fdc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
      0x0c408000fdd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c408000fde0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c408000fdf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c408000fe00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    =>0x0c408000fe10:[fc]fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      0x0c408000fe20: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      0x0c408000fe30: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      0x0c408000fe40: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      0x0c408000fe50: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      0x0c408000fe60: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
      Shadow gap:              cc
    ==7686==ABORTING

Refs: https://github.com/ClickHouse-Extras/replxx/pull/16

v2: fix test, do not use /dev/null since it client will lock it
2021-06-19 18:41:33 +03:00
..
abseil-cpp@4f3b686f86 Fork abseil-cpp to remove dependency on errno@GLIBC_PRIVATE, __pthread_unwind@GLIBC_PRIVATE and to fix shared build. 2020-11-24 17:55:02 +03:00
abseil-cpp-cmake Updated CacheDictionary 2021-03-06 14:36:37 +03:00
AMQP-CPP@03781aaff0 Update AMQP for BoringSSL 2020-11-29 11:53:15 +03:00
amqpcpp-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
antlr4-runtime@672643e9a4 Bump submodules to versions with fixes 2021-04-09 18:07:11 +04:00
antlr4-runtime-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
arrow@616b3dc76a Remove recursive submodules 2021-03-31 04:41:25 +03:00
arrow-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
avro@e43c46e87f More pytest fixes (#23538) 2021-06-07 20:29:19 +03:00
avro-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
aws@7d48b2c819 Updated AWS C++ SDK. 2021-01-26 20:58:02 +03:00
aws-c-common@736a82d169
aws-c-event-stream@3bc33662f9
aws-checksums@519d6d9093
aws-s3-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
base64@af9b331f2b Fix UBSan report in base64 2020-07-12 22:38:37 +03:00
base64-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
boost@1ccbb5a522 Update boost to avoid MSan in small_vector 2021-04-29 10:43:56 +03:00
boost-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
boringssl@a6a2e2ab3e Updates submodules bringing in several upstream changes to build on 2021-05-14 19:38:36 -07:00
boringssl-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
brotli@63be8a9940 Update brotli to a version with a recent origin fix: "encoder: fix rare access to uninitialized data in ring-buffer" 2021-02-26 11:50:01 +00:00
brotli-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
capnproto@a00ccd91b3
capnproto-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
cassandra@eb9b68dadb suppress msan cassandra 2021-05-28 16:22:50 +03:00
cctz@c0f1bcb97f Update cctz to 2020e 2020-12-25 23:36:44 +03:00
cctz-cmake Adds a better way to include binary resources 2021-06-09 14:03:30 -07:00
cityhash102
consistent-hashing
cppkafka@5a119f689f Fix kafka failover issue (#21118). 2021-06-09 16:02:56 +02:00
cppkafka-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
croaring@2c867e9f9c Update roaring just in case 2021-06-10 02:36:36 +03:00
croaring-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
curl@3b8bbbbd16
curl-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
cyrus-sasl@e6466edfd6 Fix cyrus-sasl msan warning 2021-04-27 10:45:16 +03:00
cyrus-sasl-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
datasketches-cpp@7d73d7610d update contrib/datasketches-cpp to upstream latest 2021-05-05 19:29:05 +08:00
double-conversion@cf2f0f3d54
double-conversion-cmake Somewhat better support for paths with whitespaces 2021-04-24 22:48:44 +03:00
dragonbox@923705af6f Update Dragonbox 2021-01-17 23:38:59 +03:00
dragonbox-cmake better 2020-12-07 21:26:02 +03:00
fast_float@7eae925b51 Updated submodule 2020-12-06 23:37:36 +03:00
fastops@88752a5e03
fastops-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
flatbuffers@eb3f827948 update 2021-06-18 13:34:15 +03:00
fmtlib@c108ee1d59 Update fmtlib to master 2020-07-13 03:46:57 +03:00
fmtlib-cmake
gcem@8d4f1b5d76 Add bayesAB function for bayesian_ab_testing 2020-07-09 22:11:40 +09:00
googletest@e7e591764b Update 2021-03-19 14:34:52 +08:00
grpc@60c986e15c Try mute grpc for msan. 2021-05-17 17:19:35 +03:00
grpc-cmake Updated CacheDictionary 2021-03-06 14:36:37 +03:00
h3@e209086ae1 Fix buffer overflow in Uber H3 library 2021-01-21 21:40:14 +03:00
h3-cmake Somewhat better support for paths with whitespaces 2021-04-24 22:48:44 +03:00
hyperscan@e9f08df021 Fix debug assertion in Hyperscan 2021-01-31 07:23:07 +03:00
hyperscan-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
icu@faa2f9f9e1
icu-cmake Somewhat better support for paths with whitespaces 2021-04-24 22:48:44 +03:00
icudata@f020820388
jemalloc@e6891d9746 MADV_DONTNEED check in runtime for qemu (via patching jemalloc) 2020-12-19 15:34:12 +03:00
jemalloc-cmake Update contrib/jemalloc-cmake/CMakeLists.txt 2021-06-07 16:38:24 +08:00
krb5@5149dea4e2 Fix MSan report in Kerberos library 2021-01-17 21:35:53 +03:00
krb5-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
libc-headers@a720b7105a Update libc headers 2020-12-17 20:25:51 +03:00
libcpuid@8db3b8d2d3
libcpuid-cmake Disable base64, fastops and libcpuid on unsupported platforms better 2021-04-02 13:57:46 +03:00
libcxx@2fa892f69a Bump submodules to versions with fixes 2021-04-09 18:07:11 +04:00
libcxx-cmake Somewhat better support for paths with whitespaces 2021-04-24 22:48:44 +03:00
libcxxabi@df8f1e727d Update libcxx and use unstable ABI to provide better performance 2021-01-11 02:08:33 +00:00
libcxxabi-cmake Somewhat better support for paths with whitespaces 2021-04-24 22:48:44 +03:00
libdivide Update libdivide to the latest master (2) 2021-03-30 00:37:27 +03:00
libfarmhash
libgsasl@383ee28e82 cleanup, fixes, new submodules, ShellCommand, WriteBufferFromString 2020-12-16 14:48:33 +03:00
libhdfs3@095b9d48b4 cleanup, fixes, new submodules, ShellCommand, WriteBufferFromString 2020-12-16 14:48:33 +03:00
libhdfs3-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
libmetrohash Refactor CMake build files (#11390) 2020-06-09 13:54:49 +03:00
libpq@c7624588dd Fix 2021-03-18 20:04:54 +00:00
libpq-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
libpqxx@357608d11b Update libpqxx 2021-06-16 09:38:33 +03:00
libpqxx-cmake Update CmakeLists.txt 2021-05-22 17:26:12 +00:00
librdkafka@43491d33ca Update to librdkafka 1.6.1 2021-05-04 10:05:12 +02:00
librdkafka-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
libunwind@a491c27b33 Reverted libunwind from upstream 2021-06-01 21:09:41 +03:00
libunwind-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
libuv@e2e9b7e9f9 fix 2021-01-19 01:02:48 +03:00
libxml2@18890f471c
libxml2-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
llvm@e575145941 Manually disable LLVM parts submodule update 2021-05-24 20:52:12 +03:00
lz4@f39b79fb02
lz4-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
mariadb-connector-c@5f4034a3a6 Updated MariaDB connector fix cmake 2021-04-08 21:47:12 +03:00
miniselect@be0af6bd0b Move miniselect to submodule and replace quantile exact with better algorithm 2020-11-10 00:53:43 +03:00
msgpack-c@46684265d5
murmurhash
nanodbc@9fc4596755 Update nanodbc 2021-03-29 17:36:17 +00:00
nanodbc-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
NuRaft@2a1bf7d87b Fix build 2021-06-01 10:58:53 +03:00
nuraft-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
openldap@0208811b60 Update OpenLDAP for BoringSSL 2020-11-29 11:51:32 +03:00
openldap-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
orc@5981208e39
pdqsort
poco@5994506908 Updates submodules bringing in several upstream changes to build on 2021-05-14 19:38:36 -07:00
poco-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
protobuf@73b1281420 Update contrib/grpc & contrib/protobuf. 2020-11-24 17:53:34 +03:00
protobuf-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
rapidjson@c4ef90ccdb Update submodules 2020-08-05 17:53:20 +03:00
re2@13ebb377c6 Update re2 to 2021-04-01 for GCC 11 compatibility 2021-05-17 13:30:55 +02:00
re2_st re2_st: Avoid replacing re2::re2_internal 2021-05-17 13:49:48 +02:00
replxx@c81be6c68b Fix container-overflow in replxx during incremental search (Ctrl-R) 2021-06-19 18:41:33 +03:00
replxx-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
rocksdb@07c77549a2 Updates submodules bringing in several upstream changes to build on 2021-05-14 19:38:36 -07:00
rocksdb-cmake Merge branch 'master' into cleanup-rocksdb-cmake 2021-04-25 04:11:50 +03:00
sentry-native@94644e92f0 Remove submodules 2020-08-05 17:32:23 +03:00
simdjson@8df32cea33 bump simdjson to fix crash when alloc fails 2021-05-15 14:15:51 +08:00
simdjson-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
snappy@3f194acb57
sparsehash-c11@cf0bffaa45
stats@b6dd459c10 Add bayesAB function for bayesian_ab_testing 2020-07-09 22:11:40 +09:00
stats-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
thrift@010ccf0a0c
unixodbc@b0ad30f7f6
unixodbc-cmake Maybe better support for paths with whitespaces 2021-04-24 22:47:52 +03:00
xz@869b9d1b4e fixed whitespaces, added hidden submodule file 2020-11-02 23:04:49 +03:00
yaml-cpp@0c86adac6d Implemented YAMLParser class 2021-05-21 21:56:22 +03:00
yaml-cpp-cmake Implemented YAMLParser class 2021-05-21 21:56:22 +03:00
zlib-ng@db232d30b4 Updates submodules bringing in several upstream changes to build on 2021-05-14 19:38:36 -07:00
zstd@a488ba114e Update zstd to v1.5.0 2021-05-15 00:57:24 +02:00
zstd-cmake Update zstd to v1.5.0 2021-05-15 00:57:24 +02:00
CMakeLists.txt Remove experimental compression codecs 2021-06-06 02:26:52 +03:00