Merge pull request #27480 from taosdata/fix/3.0/TD-31654

fix:[TD-31654] fix heap-buffer-overflow caused by unintialized variable.
This commit is contained in:
dapan1121 2024-08-27 15:17:51 +08:00 committed by GitHub
commit 2515275800
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 5 deletions

View File

@ -1591,16 +1591,14 @@ int32_t substrIdxFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
SColumnInfoData *pInputData[3];
SColumnInfoData *pOutputData = pOutput[0].columnData;
int32_t outputLen;
int32_t numOfRows;
int32_t numOfRows = 0;
pInputData[0] = pInput[0].columnData;
pInputData[1] = pInput[1].columnData;
pInputData[2] = pInput[2].columnData;
for (int32_t i = 0; i < inputNum; ++i) {
if (pInput[i].numOfRows > numOfRows) {
numOfRows = pInput[i].numOfRows;
}
numOfRows = TMAX(numOfRows, pInput[i].numOfRows);
}
outputLen = pInputData[0]->info.bytes;
@ -1619,9 +1617,13 @@ int32_t substrIdxFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
for (int32_t i = 0; i < inputNum; ++i) {
if (colDataIsNull_s(pInputData[i], k) || IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[i]))) {
colDataSetNULL(pOutputData, k);
continue;
hasNull = true;
break;
}
}
if (hasNull) {
continue;
}
int32_t colIdx1 = (pInput[0].numOfRows == 1) ? 0 : k;
int32_t colIdx2 = (pInput[1].numOfRows == 1) ? 0 : k;