[TD-4394]fix core when select data after modify tag width

This commit is contained in:
lichuang 2021-06-16 10:44:01 +08:00
parent 019860111d
commit c2a558cd21
2 changed files with 3 additions and 2 deletions

View File

@ -7519,7 +7519,8 @@ static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type
if (IS_VAR_DATA_TYPE(type)) { if (IS_VAR_DATA_TYPE(type)) {
// Binary data overflows for sort of unknown reasons. Let trim the overflow data // Binary data overflows for sort of unknown reasons. Let trim the overflow data
if (varDataTLen(val) > bytes) { if (varDataTLen(val) > bytes) {
int32_t len = bytes - VARSTR_HEADER_SIZE; // remain available space int32_t maxLen = bytes - VARSTR_HEADER_SIZE;
int32_t len = (varDataLen(val) > maxLen)? maxLen:varDataLen(val);
memcpy(varDataVal(output), varDataVal(val), len); memcpy(varDataVal(output), varDataVal(val), len);
varDataSetLen(output, len); varDataSetLen(output, len);
} else { } else {

View File

@ -211,7 +211,7 @@ void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_
} }
char *val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId); char *val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId);
assert(type == pCol->type && bytes == pCol->bytes); assert(type == pCol->type && bytes >= pCol->bytes);
// if (val != NULL && IS_VAR_DATA_TYPE(type)) { // if (val != NULL && IS_VAR_DATA_TYPE(type)) {
// assert(varDataLen(val) < pCol->bytes); // assert(varDataLen(val) < pCol->bytes);