Merge pull request #18401 from taosdata/fix/TD-20605
fix: [ASAN] fix null pointer in tdatablock.c
This commit is contained in:
commit
d31be656e3
|
@ -90,6 +90,33 @@ static FORCE_INLINE bool colDataIsNull_s(const SColumnInfoData* pColumnInfoData,
|
|||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE bool colDataIsNNull_s(const SColumnInfoData* pColumnInfoData, int32_t startIndex,
|
||||
uint32_t nRows) {
|
||||
if (!pColumnInfoData->hasNull) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||
for (int32_t i = startIndex; i < nRows; ++i) {
|
||||
if (!colDataIsNull_var(pColumnInfoData, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pColumnInfoData->nullbitmap == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int32_t i = startIndex; i < nRows; ++i) {
|
||||
if (!colDataIsNull_f(pColumnInfoData->nullbitmap, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, uint32_t totalRows, uint32_t row,
|
||||
SColumnDataAgg* pColAgg) {
|
||||
if (!pColumnInfoData->hasNull) {
|
||||
|
|
|
@ -652,7 +652,10 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity)
|
|||
ASSERT(pCol->varmeta.length <= pCol->varmeta.allocLen);
|
||||
}
|
||||
|
||||
memcpy(pCol->pData, pStart, colLength);
|
||||
if (!colDataIsNNull_s(pCol, 0, pBlock->info.rows)) {
|
||||
memcpy(pCol->pData, pStart, colLength);
|
||||
}
|
||||
|
||||
pStart += pCol->info.bytes * capacity;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue