drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject [3/7] drill git commit: DRILL-5316: Check drillbits size before we attempt to access the vector element
Date Mon, 20 Mar 2017 15:56:56 GMT
DRILL-5316: Check drillbits size before we attempt to access the vector element

close apache/drill#772


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/90bc8005
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/90bc8005
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/90bc8005

Branch: refs/heads/master
Commit: 90bc80052f66874cf9eaf8b8bc93f28f703b5506
Parents: 97e2a1d
Author: Rob Wu <robwu15@gmail.com>
Authored: Mon Mar 6 18:17:25 2017 -0800
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Mon Mar 20 08:08:13 2017 -0700

----------------------------------------------------------------------
 contrib/native/client/src/clientlib/drillClientImpl.cpp | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/90bc8005/contrib/native/client/src/clientlib/drillClientImpl.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index a41cb4b..9d45f57 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -86,6 +86,9 @@ connectionStatus_t DrillClientImpl::connect(const char* connStr, DrillUserProper
         std::vector<std::string> drillbits;
         int err = zook.getAllDrillbits(hostPortStr, drillbits);
         if(!err){
+            if (drillbits.empty()){
+                return handleConnError(CONN_FAILURE, getMessage(ERR_CONN_ZKNODBIT));
+            }
             Utils::shuffle(drillbits);
             exec::DrillbitEndpoint endpoint;
             err = zook.getEndPoint(drillbits[drillbits.size() -1], endpoint);// get the last
one in the list
@@ -2142,6 +2145,9 @@ connectionStatus_t PooledDrillClientImpl::connect(const char* connStr,
DrillUser
         std::vector<std::string> drillbits;
         int err = zook.getAllDrillbits(hostPortStr, drillbits);
         if(!err){
+            if (drillbits.empty()){
+                return handleConnError(CONN_FAILURE, getMessage(ERR_CONN_ZKNODBIT));
+            }
             Utils::shuffle(drillbits);
             // The original shuffled order is maintained if we shuffle first and then add
any missing elements
             Utils::add(m_drillbits, drillbits);


Mime
View raw message