mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
fix: ubsan, EMPTY_STRING_REF constant
This commit is contained in:
parent
cf696afd4c
commit
0f5b089270
@ -45,9 +45,11 @@ struct StringRef
|
||||
constexpr explicit operator std::string_view() const { return {data, size}; }
|
||||
};
|
||||
|
||||
/// Holds {nullptr, 0};
|
||||
/// Here constexpr doesn't implicate inline, see https://www.viva64.com/en/w/v1043/
|
||||
constexpr const inline StringRef EMPTY_STRING_REF{};
|
||||
/// nullptr can't be used because the StringRef values are used in SipHash's pointer arithmetics
|
||||
/// and the UBSan thinks that something like nullptr + 8 is UB.
|
||||
constexpr const inline char empty_string_ref_addr{};
|
||||
constexpr const inline StringRef EMPTY_STRING_REF{&empty_string_ref_addr, 0};
|
||||
|
||||
using StringRefs = std::vector<StringRef>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user