Merge pull request #24117 from taosdata/fix/TD-27933

fix(tsdb/cache): fix buffer-overflow with column adding
This commit is contained in:
Hongze Cheng 2023-12-18 20:09:43 +08:00 committed by GitHub
commit 087896d9de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -2745,6 +2745,13 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
break;
}
SLastCol *pCol = taosArrayGet(pColArray, iCol);
if (slotIds[iCol] > pTSchema->numOfCols - 1) {
if (!setNoneCol) {
noneCol = iCol;
setNoneCol = true;
}
continue;
}
if (pCol->colVal.cid != pTSchema->columns[slotIds[iCol]].colId) {
continue;
}
@ -2919,6 +2926,9 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
break;
}
SLastCol *pCol = taosArrayGet(pColArray, iCol);
if (slotIds[iCol] > pTSchema->numOfCols - 1) {
continue;
}
if (pCol->colVal.cid != pTSchema->columns[slotIds[iCol]].colId) {
continue;
}