提交 18c0457a 编写于 作者: H Haojun Liao

[td-225]fix null tag caused crash.

上级 c7e96a44
...@@ -2720,7 +2720,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag, ...@@ -2720,7 +2720,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag,
val = tsdbGetTableTagVal(pTable, tagColId, type, bytes); val = tsdbGetTableTagVal(pTable, tagColId, type, bytes);
} }
if (isNull(val, type)) { if (val == NULL || isNull(val, type)) {
tag->nType = TSDB_DATA_TYPE_NULL; tag->nType = TSDB_DATA_TYPE_NULL;
return; return;
} }
...@@ -6524,7 +6524,7 @@ static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type ...@@ -6524,7 +6524,7 @@ 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; int32_t len = bytes - VARSTR_HEADER_SIZE; // remain available space
memcpy(varDataVal(output), varDataVal(val), len); memcpy(varDataVal(output), varDataVal(val), len);
varDataSetLen(output, len); varDataSetLen(output, len);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册