From f201f8ababd1d5ba064eb924ea86b2a71b5bbd1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Wed, 10 Apr 2019 17:39:07 +0300 Subject: [PATCH] types: fix date_type_impl::less() (timestamp cql type) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit date_type_impl::less() invokes `compare_unsigned()` to compare the underlying raw byte values. `compared_unsigned()` is a tri comparator, however `date_type_impl::less()` implicitely converted the returned value to bool. In effect, `date_type_impl::less()` would *always* return `true` when the two compared values were not equal. Found while working on a unit test which empoly a randomly generated schema to test a component. Fixes #4419. Signed-off-by: Botond Dénes Message-Id: <8a17c81bad586b3772bf3d1d1dae0e3dc3524e2d.1554907100.git.bdenes@scylladb.com> --- types.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types.cc b/types.cc index 37f80591fb..5f30fcbf87 100644 --- a/types.cc +++ b/types.cc @@ -589,7 +589,7 @@ public: return make_value(db_clock::time_point(db_clock::duration(tmp))); } virtual bool less(bytes_view b1, bytes_view b2) const override { - return compare_unsigned(b1, b2); + return compare_unsigned(b1, b2) < 0; } virtual bool is_byte_order_comparable() const override { return true;