未验证 提交 8fd163b1 编写于 作者: G Ganlin Zhao 提交者: GitHub

schemaless fix measurement len = 0 causing crash (#8247)

* schemaless fix error code

* schemaless fixed measurement len = 0 crash
上级 befffdf7
......@@ -1891,6 +1891,9 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
cur++;
len++;
}
if (len == 0) {
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
}
key[len] = '\0';
if (checkDuplicateKey(key, pHash, info)) {
......@@ -1905,7 +1908,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
}
static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
bool *is_last_kv, SSmlLinesInfo* info, bool isTag) {
const char *start, *cur;
char *value = NULL;
......@@ -1931,6 +1934,11 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
cur++;
len++;
}
if (len == 0) {
free(pKV->key);
pKV->key = NULL;
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
}
value = calloc(len + 1, 1);
memcpy(value, start, len);
......@@ -1996,6 +2004,11 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
cur++;
len++;
}
if (len == 0) {
free(pSml->stableName);
pSml->stableName = NULL;
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
}
pSml->stableName[len] = '\0';
*index = cur + 1;
tscDebug("SML:0x%"PRIx64" Stable name in measurement:%s|len:%d", info->id, pSml->stableName, len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册