fix: json tag length check

This commit is contained in:
xsren 2024-10-28 11:50:25 +08:00
parent b02ad5c8e2
commit fb34549ae7
2 changed files with 11 additions and 4 deletions

View File

@ -3569,11 +3569,18 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) {
} else {
BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] == nextPos);
}
colLen = varDataTLen(pCol->pData + pCol->varmeta.offset[r]);
char* pColData = pCol->pData + pCol->varmeta.offset[r];
int32_t colSize = 0;
if (pCol->info.type == TSDB_DATA_TYPE_JSON) {
colLen = getJsonValueLen(pColData);
} else {
colLen = varDataTLen(pColData);
}
BLOCK_DATA_CHECK_TRESSA(colLen >= VARSTR_HEADER_SIZE);
BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->info.bytes);
if (pCol->reassigned) {
BLOCK_DATA_CHECK_TRESSA((pCol->varmeta.offset[r] + colLen) <= pCol->varmeta.length);
} else {

View File

@ -1606,7 +1606,7 @@ static int32_t translateOutVarchar(SFunctionNode* pFunc, char* pErrBuf, int32_t
break;
case FUNCTION_TYPE_BLOCK_DIST:
case FUNCTION_TYPE_BLOCK_DIST_INFO:
bytes = 128;
bytes = sizeof(STableBlockDistInfo);
break;
case FUNCTION_TYPE_TO_CHAR:
bytes = 4096;