From 18c0457af25ac59ff5d70caa9fadaafc37f71275 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 16 Mar 2021 10:19:00 +0800 Subject: [PATCH] [td-225]fix null tag caused crash. --- src/query/src/qExecutor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 1b3d8ec294..c8295f27cf 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -2720,7 +2720,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag, val = tsdbGetTableTagVal(pTable, tagColId, type, bytes); } - if (isNull(val, type)) { + if (val == NULL || isNull(val, type)) { tag->nType = TSDB_DATA_TYPE_NULL; return; } @@ -6524,7 +6524,7 @@ 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; + int32_t len = bytes - VARSTR_HEADER_SIZE; // remain available space memcpy(varDataVal(output), varDataVal(val), len); varDataSetLen(output, len); } else { -- GitLab