提交 0ea961b6 编写于 作者: G Ganlin Zhao

fix: [ASAN] fix nullpointer issue in tdatablock.c

上级 fe171df1
...@@ -509,8 +509,12 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3 ...@@ -509,8 +509,12 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
isNull = colDataIsNull(pColData, pBlock->info.rows, j, pBlock->pBlockAgg[i]); isNull = colDataIsNull(pColData, pBlock->info.rows, j, pBlock->pBlockAgg[i]);
} }
char* p = colDataGetData(pColData, j); if (isNull) {
colDataAppend(pDstCol, j - startIndex, p, 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 ...@@ -807,7 +811,9 @@ static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataB
SColumnInfoData* pSrc = taosArrayGet(pDataBlock->pDataBlock, i); SColumnInfoData* pSrc = taosArrayGet(pDataBlock->pDataBlock, i);
if (IS_VAR_DATA_TYPE(pSrc->info.type)) { 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; pDst->varmeta.length = pSrc->varmeta.length;
for (int32_t j = 0; j < pDataBlock->info.rows; ++j) { for (int32_t j = 0; j < pDataBlock->info.rows; ++j) {
......
...@@ -38,7 +38,7 @@ python_error=`cat ${LOG_DIR}/*.info | grep -w "stack" | wc -l` ...@@ -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/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' # /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 error_num: $error_num"\033[0m"
echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m" echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m"
...@@ -58,4 +58,4 @@ else ...@@ -58,4 +58,4 @@ else
fi fi
cat ${LOG_DIR}/*.asan cat ${LOG_DIR}/*.asan
exit 1 exit 1
fi fi
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册