From 7da40832376aa66f270f4398bb1b77c471f8d225 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 30 Jan 2021 07:13:49 +0300 Subject: [PATCH] Forbid bit functions for floats This will fix the following UB report [1]: "../src/Functions/bitAnd.cpp:24:61: runtime error: nan is outside the range of representable values of type 'long' Received signal -3 Received signal Unknown signal (-3)" [1]: https://clickhouse-test-reports.s3.yandex.net/19824/89c4055202b9d08459f90ee5791d4e3017b82fbf/fuzzer_ubsan/report.html#fail1 --- src/Functions/FunctionBinaryArithmetic.h | 62 +++++++++++++++---- src/Functions/bitAnd.cpp | 2 +- src/Functions/bitOr.cpp | 2 +- src/Functions/bitRotateLeft.cpp | 2 +- src/Functions/bitRotateRight.cpp | 2 +- src/Functions/bitShiftLeft.cpp | 2 +- src/Functions/bitShiftRight.cpp | 2 +- src/Functions/bitTest.cpp | 2 +- src/Functions/bitXor.cpp | 2 +- .../01576_if_null_external_aggregation.sql | 2 +- .../0_stateless/01677_bit_float.reference | 0 tests/queries/0_stateless/01677_bit_float.sql | 9 +++ 12 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 tests/queries/0_stateless/01677_bit_float.reference create mode 100644 tests/queries/0_stateless/01677_bit_float.sql diff --git a/src/Functions/FunctionBinaryArithmetic.h b/src/Functions/FunctionBinaryArithmetic.h index c10ff581b0e..f61c9c91d00 100644 --- a/src/Functions/FunctionBinaryArithmetic.h +++ b/src/Functions/FunctionBinaryArithmetic.h @@ -504,7 +504,7 @@ private: using namespace traits_; using namespace impl_; -template