Merge pull request #22969 from taosdata/fix/m/TS-4013

fix: query tbname from systables memory corruption
This commit is contained in:
dapan1121 2023-09-19 17:33:23 +08:00 committed by GitHub
commit dfdcbdedc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 14 deletions

View File

@ -2353,27 +2353,26 @@ void trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolList
int32_t maxRows = 0; int32_t maxRows = 0;
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) { if (!pBoolList) {
SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); for (int32_t i = 0; i < numOfCols; ++i) {
// it is a reserved column for scalar function, and no data in this column yet. SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i);
if (pDst->pData == NULL) { // it is a reserved column for scalar function, and no data in this column yet.
continue; if (pDst->pData == NULL) {
} continue;
}
int32_t numOfRows = 0; int32_t numOfRows = 0;
if (IS_VAR_DATA_TYPE(pDst->info.type)) { if (IS_VAR_DATA_TYPE(pDst->info.type)) {
pDst->varmeta.length = 0; pDst->varmeta.length = 0;
}
} }
}
if (NULL == pBoolList) {
return; return;
} }
for (int32_t i = 0; i < numOfCols; ++i) { for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i);
// it is a reserved column for scalar function, and no data in this column yet. // it is a reserved column for scalar function, and no data in this column yet.
if (pDst->pData == NULL) { if (pDst->pData == NULL || (IS_VAR_DATA_TYPE(pDst->info.type) && pDst->varmeta.length == 0)) {
continue; continue;
} }