Merge pull request #22744 from taosdata/fix/TD-26157
fix:return TSDB_CODE_PAR_VALUE_TOO_LONG if data value is longer than bytes
This commit is contained in:
commit
5f6e02d040
|
@ -2460,10 +2460,10 @@ int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t byt
|
||||||
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
|
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
|
||||||
if (code) goto _exit;
|
if (code) goto _exit;
|
||||||
} else {
|
} else {
|
||||||
if (ASSERT(varDataTLen(data + offset) <= bytes)) {
|
if (varDataTLen(data + offset) > bytes) {
|
||||||
uError("var data length invalid, varDataTLen(data + offset):%d <= bytes:%d", (int)varDataTLen(data + offset),
|
uError("var data length invalid, varDataTLen(data + offset):%d <= bytes:%d", (int)varDataTLen(data + offset),
|
||||||
bytes);
|
bytes);
|
||||||
code = TSDB_CODE_INVALID_PARA;
|
code = TSDB_CODE_PAR_VALUE_TOO_LONG;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, (uint8_t *)varDataVal(data + offset),
|
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, (uint8_t *)varDataVal(data + offset),
|
||||||
|
|
|
@ -683,8 +683,10 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
|
||||||
pStart += BitmapLen(numOfRows);
|
pStart += BitmapLen(numOfRows);
|
||||||
}
|
}
|
||||||
char* pData = pStart;
|
char* pData = pStart;
|
||||||
|
ret = tColDataAddValueByDataBlock(pCol, pColSchema->type, pColSchema->bytes, numOfRows, offset, pData);
|
||||||
tColDataAddValueByDataBlock(pCol, pColSchema->type, pColSchema->bytes, numOfRows, offset, pData);
|
if(ret != 0){
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
fields += sizeof(int8_t) + sizeof(int32_t);
|
fields += sizeof(int8_t) + sizeof(int32_t);
|
||||||
if (needChangeLength) {
|
if (needChangeLength) {
|
||||||
pStart += htonl(colLength[j]);
|
pStart += htonl(colLength[j]);
|
||||||
|
@ -712,7 +714,10 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
|
||||||
char* pData = pStart;
|
char* pData = pStart;
|
||||||
|
|
||||||
SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, j);
|
SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, j);
|
||||||
tColDataAddValueByDataBlock(pCol, pColSchema->type, pColSchema->bytes, numOfRows, offset, pData);
|
ret = tColDataAddValueByDataBlock(pCol, pColSchema->type, pColSchema->bytes, numOfRows, offset, pData);
|
||||||
|
if(ret != 0){
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
fields += sizeof(int8_t) + sizeof(int32_t);
|
fields += sizeof(int8_t) + sizeof(int32_t);
|
||||||
if (needChangeLength) {
|
if (needChangeLength) {
|
||||||
pStart += htonl(colLength[i]);
|
pStart += htonl(colLength[i]);
|
||||||
|
@ -729,7 +734,10 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
|
||||||
for (int c = 0; c < boundInfo->numOfBound; ++c) {
|
for (int c = 0; c < boundInfo->numOfBound; ++c) {
|
||||||
if( boundInfo->pColIndex[c] != -1){
|
if( boundInfo->pColIndex[c] != -1){
|
||||||
SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, c);
|
SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, c);
|
||||||
tColDataAddValueByDataBlock(pCol, 0, 0, numOfRows, NULL, NULL);
|
ret = tColDataAddValueByDataBlock(pCol, 0, 0, numOfRows, NULL, NULL);
|
||||||
|
if(ret != 0){
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
boundInfo->pColIndex[c] = c; // restore for next block
|
boundInfo->pColIndex[c] = c; // restore for next block
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue