From 32aa8823cf321c064fbdbf47fdace6cdc013ffcc Mon Sep 17 00:00:00 2001
From: Simon Liu <331435+monadbobo@users.noreply.github.com>
Date: Mon, 14 Oct 2019 10:26:19 +0800
Subject: [PATCH] Fixed an undefined behavior. (#1039)

2 Replace static_cast with dynamic_cast.
---
 src/executor/FetchExecutor.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/executor/FetchExecutor.cpp b/src/executor/FetchExecutor.cpp
index 26dcc9be..b2d8df0a 100644
--- a/src/executor/FetchExecutor.cpp
+++ b/src/executor/FetchExecutor.cpp
@@ -34,11 +34,11 @@ Status FetchExecutor::prepareYield() {
         // such as YIELD 1+1, it has not type in schema, the type from the eval()
         colTypes_.emplace_back(nebula::cpp2::SupportedType::UNKNOWN);
         if (col->expr()->isAliasExpression()) {
-            colNames_.emplace_back(*static_cast<InputPropertyExpression*>(col->expr())->prop());
+            colNames_.emplace_back(*dynamic_cast<AliasPropertyExpression*>(col->expr())->prop());
             continue;
         } else if (col->expr()->isTypeCastingExpression()) {
             // type cast
-            auto exprPtr = static_cast<TypeCastingExpression*>(col->expr());
+            auto exprPtr = dynamic_cast<TypeCastingExpression*>(col->expr());
             colTypes_.back() = ColumnTypeToSupportedType(exprPtr->getType());
         }
 
-- 
GitLab