From c2a558cd21bc4d9e2c3f1eabd3a2d4384c0b95a2 Mon Sep 17 00:00:00 2001 From: lichuang Date: Wed, 16 Jun 2021 10:44:01 +0800 Subject: [PATCH] [TD-4394]fix core when select data after modify tag width --- src/query/src/qExecutor.c | 3 ++- src/tsdb/src/tsdbMeta.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 77ceabbd63..3227102559 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -7519,7 +7519,8 @@ static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type if (IS_VAR_DATA_TYPE(type)) { // Binary data overflows for sort of unknown reasons. Let trim the overflow data 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); varDataSetLen(output, len); } else { diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 86e3aea4b5..17223c99fe 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -211,7 +211,7 @@ void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_ } 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)) { // assert(varDataLen(val) < pCol->bytes); -- GitLab