fix[TS-5812]:add params check
This commit is contained in:
parent
a95304a857
commit
25dc5d7b5c
|
@ -2672,7 +2672,8 @@ static void (*tColDataGetValueImpl[])(SColData *pColData, int32_t iVal, SColVal
|
||||||
tColDataGetValue7 // HAS_VALUE | HAS_NULL | HAS_NONE
|
tColDataGetValue7 // HAS_VALUE | HAS_NULL | HAS_NONE
|
||||||
};
|
};
|
||||||
int32_t tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal) {
|
int32_t tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal) {
|
||||||
if (iVal < 0 && iVal >= pColData->nVal || pColData->flag <= 0){
|
if (iVal < 0 || iVal >= pColData->nVal ||
|
||||||
|
(pColData->flag <= 0 || pColData->flag >= sizeof(tColDataGetValueImpl)/POINTER_BYTES)){
|
||||||
return TSDB_CODE_INVALID_PARA;
|
return TSDB_CODE_INVALID_PARA;
|
||||||
}
|
}
|
||||||
tColDataGetValueImpl[pColData->flag](pColData, iVal, pColVal);
|
tColDataGetValueImpl[pColData->flag](pColData, iVal, pColVal);
|
||||||
|
|
|
@ -450,6 +450,19 @@ static void checkTSRow(const char **data, STSRow *row, STSchema *pTSchema) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(testCase, tColDataGetValue) {
|
||||||
|
SColData pColData = {0};
|
||||||
|
SColVal pColVal = {0};
|
||||||
|
ASSERT_NE(tColDataGetValue(&pColData, 0, &pColVal),0);
|
||||||
|
|
||||||
|
pColData = {.flag = 8};
|
||||||
|
pColVal = {0};
|
||||||
|
ASSERT_NE(tColDataGetValue(&pColData, 0, &pColVal),0);
|
||||||
|
|
||||||
|
pColData = {.nVal = 1, .flag = 8};
|
||||||
|
ASSERT_NE(tColDataGetValue(&pColData, 0, &pColVal),0);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(testCase, AllNormTest) {
|
TEST(testCase, AllNormTest) {
|
||||||
int16_t nCols = 14;
|
int16_t nCols = 14;
|
||||||
STSRow *row = nullptr;
|
STSRow *row = nullptr;
|
||||||
|
|
|
@ -325,7 +325,6 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
|
||||||
ctx->suidInfo = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
ctx->suidInfo = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||||
if (ctx->suidInfo == NULL) {
|
if (ctx->suidInfo == NULL) {
|
||||||
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
taosHashSetFreeFp(ctx->suidInfo, destroySTableInfoForChildTable);
|
taosHashSetFreeFp(ctx->suidInfo, destroySTableInfoForChildTable);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue