From 09cc26f044f1aa2050334a7600a613e7d788bf0d Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 6 Sep 2022 10:26:59 +0800 Subject: [PATCH] fix: return syntax error when field num is zero in line protocol --- src/client/src/tscParseLineProtocol.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index 81056f2f77..a5673378f5 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -930,7 +930,7 @@ _cleanup: free(colKVs); if (r == fromIndex) { - tscError("buffer can not fit one line"); + tscDebug("buffer can not fit one line"); *cTableSqlLen = 0; } else { *cTableSqlLen = totalLen; @@ -2608,6 +2608,12 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf return ret; } tscDebug("SML:0x%"PRIx64" Parse fields finished, num of fields:%d", info->id, smlData->fieldNum); + if (smlData->fieldNum == 0) { + tscDebug("SML:0x%"PRIx64" Parse fields error, no field in line", info->id); + taosHashCleanup(keyHashTable); + return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; + } + taosHashCleanup(keyHashTable); //Parse timestamp -- GitLab