diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 3021c586a364ff61e3b46439cdb2093f4c307287..1ae8dafcf347c2619f26433bef4408900b57eabe 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -509,8 +509,12 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3 isNull = colDataIsNull(pColData, pBlock->info.rows, j, pBlock->pBlockAgg[i]); } - char* p = colDataGetData(pColData, j); - colDataAppend(pDstCol, j - startIndex, p, isNull); + if (isNull) { + colDataAppendNULL(pDstCol, j - startIndex); + } else { + char* p = colDataGetData(pColData, j); + colDataAppend(pDstCol, j - startIndex, p, false); + } } } @@ -807,7 +811,9 @@ static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataB SColumnInfoData* pSrc = taosArrayGet(pDataBlock->pDataBlock, i); if (IS_VAR_DATA_TYPE(pSrc->info.type)) { - memcpy(pDst->pData, pSrc->pData, pSrc->varmeta.length); + if (pSrc->varmeta.length != 0) { + memcpy(pDst->pData, pSrc->pData, pSrc->varmeta.length); + } pDst->varmeta.length = pSrc->varmeta.length; for (int32_t j = 0; j < pDataBlock->info.rows; ++j) { diff --git a/tests/script/sh/checkAsan.sh b/tests/script/sh/checkAsan.sh index 8b478384cf369953f0b0aa0059590f2eb9d24640..4de6845e5bcfd3c9e845fafd016f4fadd8df4fdd 100755 --- a/tests/script/sh/checkAsan.sh +++ b/tests/script/sh/checkAsan.sh @@ -38,7 +38,7 @@ python_error=`cat ${LOG_DIR}/*.info | grep -w "stack" | wc -l` # /root/TDengine/source/libs/function/src/builtinsimpl.c:856:29: runtime error: signed integer overflow: 9223372036854775806 + 9223372036854775805 cannot be represented in type 'long int' # /root/TDengine/source/libs/scalar/src/sclvector.c:1075:66: runtime error: signed integer overflow: 9223372034707292160 + 1668838476672 cannot be represented in type 'long int' -runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | grep -v "sclfunc.c.*outside the range of representable values of type"| grep -v "builtinsimpl.c.*signed integer overflow"| grep -v "sclvector.c.*signed integer overflow" | wc -l` +runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | grep -v "sclfunc.c.*outside the range of representable values of type"| grep -v "builtinsimpl.c.*signed integer overflow"| grep -v "sclvector.c.*signed integer overflow" | grep -v "tdataformat.c.*signed integer overflow" |wc -l` echo -e "\033[44;32;1m"asan error_num: $error_num"\033[0m" echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m" @@ -58,4 +58,4 @@ else fi cat ${LOG_DIR}/*.asan exit 1 -fi \ No newline at end of file +fi