From 897199c22026a13be078831ed1a5acc4bf0eaf6e Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 26 Dec 2018 04:29:48 +0300 Subject: [PATCH] Fixed UB #3926 --- dbms/src/Common/Volnitsky.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbms/src/Common/Volnitsky.h b/dbms/src/Common/Volnitsky.h index 8969b611f22..f1a8325d869 100644 --- a/dbms/src/Common/Volnitsky.h +++ b/dbms/src/Common/Volnitsky.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -121,9 +122,9 @@ protected: CRTP & self() { return static_cast(*this); } const CRTP & self() const { return const_cast(this)->self(); } - static const Ngram & toNGram(const UInt8 * const pos) + static Ngram toNGram(const UInt8 * const pos) { - return *reinterpret_cast(pos); + return unalignedLoad(pos); } void putNGramBase(const Ngram ngram, const int offset)