From 6d42868283cd8eb6c920932412e08a1e774dcf6f Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Thu, 19 Nov 2015 09:50:05 +0300 Subject: [PATCH] dbms: ClickHouseDictionarySource: check that key is present before dereferencing [#METR-18945] --- dbms/include/DB/Dictionaries/ClickHouseDictionarySource.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dbms/include/DB/Dictionaries/ClickHouseDictionarySource.h b/dbms/include/DB/Dictionaries/ClickHouseDictionarySource.h index 1122df10976..3da4b0a0252 100644 --- a/dbms/include/DB/Dictionaries/ClickHouseDictionarySource.h +++ b/dbms/include/DB/Dictionaries/ClickHouseDictionarySource.h @@ -42,7 +42,7 @@ public: "ClickHouseDictionarySource") }, load_all_query{composeLoadAllQuery()}, - key_tuple_definition{composeKeyTupleDefinition()} + key_tuple_definition{dict_struct.key ? composeKeyTupleDefinition() : std::string{}} {} /// copy-constructor is provided in order to support cloneability @@ -318,6 +318,9 @@ private: std::string composeKeyTupleDefinition() const { + if (!dict_struct.key) + throw Exception{"Composite key required for method", ErrorCodes::UNSUPPORTED_METHOD}; + std::string result{"("}; auto first = true;