From b50005e702da45d7028354ea008060113ef01527 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Sat, 12 Feb 2022 22:05:28 -0800 Subject: [PATCH] add check for max h3 resolution --- src/Functions/geoToH3.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Functions/geoToH3.cpp b/src/Functions/geoToH3.cpp index 666130ed55e..12f29422367 100644 --- a/src/Functions/geoToH3.cpp +++ b/src/Functions/geoToH3.cpp @@ -11,6 +11,7 @@ #include #include +#include #include @@ -109,6 +110,14 @@ public: const double lat = data_lat[row]; const UInt8 res = data_res[row]; + if (res > MAX_H3_RES) + throw Exception( + ErrorCodes::ARGUMENT_OUT_OF_BOUND, + "The argument 'resolution' ({}) of function {} is out of bounds because the maximum resolution in H3 library is ", + toString(res), + getName(), + MAX_H3_RES); + LatLng coord; coord.lng = degsToRads(lon); coord.lat = degsToRads(lat);