From 3a91cded27052132328df376cc856f59647edfe6 Mon Sep 17 00:00:00 2001 From: Serguey Zefirov Date: Wed, 25 Jun 2025 14:13:29 +0300 Subject: [PATCH] chore(MCOL-6018) Fix incorrect Field_decimal cast This is a fix of a problem found by UBSAN. MDB changed default type to represent a decimal result, C-style cast did not do proper type checking and this one-liner fixes that. Now we will have an assertion if type changes again. --- dbcon/mysql/ha_mcs_execplan.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index c81a3d39c..e9f69b0d5 100644 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -3213,7 +3213,10 @@ CalpontSystemCatalog::ColType fieldType_MysqlToIDB(const Field* field) case DECIMAL_RESULT: { - Field_decimal* idp = (Field_decimal*)field; + const Field_new_decimal* idp = dynamic_cast(field); + + idbassert(idp); + ct.colDataType = CalpontSystemCatalog::DECIMAL; ct.colWidth = 8; ct.scale = idp->dec;